{ "id": "137318", "key": "AC-1472", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-10-01T15:10:00.000+0000", "created": "2014-09-28T19:31:00.000+0000", "labels": [ "alloy", "assets" ], "versions": [], "issuelinks": [], "assignee": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "updated": "2016-03-08T07:37:55.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." } ], "description": "I am trying to access my assets from the app>assets>iphone>images directory.\r\n\r\nThis is how I am trying to get the asset in code\r\n\r\n\t$.imageW.image = \"/iphone/images/WalkthroughIllustration_01.png\";\r\n\r\nDoesn't work\r\n\r\nI have create the image view in the related XML file\r\n\r\n\r\n\r\nThe only way I can get the image to display is if I move the asset outside of the iPhone directory, like this:\r\n\r\n\t$.imageW.image = \"/images/WalkthroughIllustration_01.png\";\r\n\r\nBUT, I have read that by doing it that way, I will be unable to display retina images.", "attachment": [], "flagged": false, "summary": "Alloy - not able to retrieve assets from iPhone folder", "creator": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Alloy, SDK 3.2.3", "comment": { "comments": [ { "id": "326029", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Hi,\r\n\r\nUnderneath the Resources/asset folder are iPhone and android folders - any resources placed in one of these folders will supersede the contents of the top-level Resources directory for a given platform. So you should not add one more folder \"images\" in it. \r\n\r\nBased on your case, All you have to do is placing your image resource in \"iPhone\" folder. Then when you reference a file(placed in iPhone folder) from your application, you should not include the platform in the name, as it is considered top-level resources.\r\n\r\nFor example:\r\n1. Place your image file WalkthroughIllustration_01.png under iPhone folder.\r\n2. Then you can access it like: {code}$.imageW.image = \"WalkthroughIllustration_01.png\";{code}\r\n\r\nHope this will help you.\r\n\r\nRegards,\r\nShuo", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-29T02:41:36.000+0000", "updated": "2014-09-29T02:41:36.000+0000" }, { "id": "326068", "author": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks Shuo,\r\n\r\nThat worked after dumping the images in the Assets->Iphone path.\r\n\r\nHowever:\r\n\r\n1) How can I test to see if the retina version of the image is loaded up instead? When I run the app in the iphone simulator (retina) and non retina, I am not sure what I am looking at.\r\n\r\n2) What is the difference in file name between retina and non retina images\r\n\r\ni.e. \"WalkthroughIllustration_01.png\" is non retina\r\n\r\nbut what is retina?\r\n\r\n3) Retina images are normally larger in size, do I need to hardcode the width and height of say the view/imageview which has it as a background? If so what should I use? pixels, percent etc?\r\n\r\nThanks", "updateAuthor": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-29T10:22:23.000+0000", "updated": "2014-09-29T10:22:23.000+0000" }, { "id": "326071", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "On the iPhone, you have two display densities to deal with: the original iPhone/iPod density and the double-density \"retina\" displays. The retina displays, featured on the iPhone 4 and presumably newer models has twice the DPI of the earlier displays. Following Apple's scheme, retina images are named to match their non-retina counterparts, with \"@2x\" appended to the name. In your code, though, you don't worry about that suffix.\r\n{code}\r\nvar img = Ti.UI.createImageView({\r\n image: 'logo.png'\r\n /* logo@2x.png will be used automatically if it exists on iPhone 4 & iPad devices */\r\n});\r\n{code}", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-29T11:08:10.000+0000", "updated": "2014-09-29T11:08:10.000+0000" }, { "id": "326072", "author": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thank you Shuo. So if I did this:\r\nvar img = Ti.UI.createView({\r\n BackgroundImage: 'logo.png',\r\n /* logo@2x.png will be used automatically if it exists on iPhone 4 & iPad devices */\r\n top: 100\r\n});\r\n\r\nAnd say the non retina image is in the correct position by default at the right dimensions.top=100, will the retina image if it gets called stay in the same dimension? (or appear bigger) Given retina images are 2 times the size.\r\n\r\nIf not, will I need to set the width and the height in code? If so what units should I use %, pixels etc", "updateAuthor": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-29T11:18:36.000+0000", "updated": "2014-09-29T11:18:36.000+0000" }, { "id": "326073", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "It should in the same dimension.", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-29T11:37:02.000+0000", "updated": "2014-09-29T11:37:02.000+0000" }, { "id": "326074", "author": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Right, so I need to hardcode the width and height? If so, what units?", "updateAuthor": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-29T11:43:25.000+0000", "updated": "2014-09-29T11:43:51.000+0000" }, { "id": "326075", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "Ye, you'd better hardcode the width and height of the imageView to keep you interface looking good. \r\nHere is the doc about the units: [http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.View-property-height]", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-29T11:52:24.000+0000", "updated": "2014-09-29T11:52:24.000+0000" }, { "id": "326076", "author": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks, what units should I use?\r\n\r\nI am confused about the difference between dp and pixels. Not sure when to use either.", "updateAuthor": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-29T12:08:52.000+0000", "updated": "2014-09-29T12:08:52.000+0000" }, { "id": "326236", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "dip : Density-independent pixels. A measurement which is translated natively to a corresponding pixel measure using a scale factor based on a platform-specific \"default\" density, and the device's physical density.\r\nSystem unit : A platform-dependent unit which is the default for how the system presents its view information to the native layout system. On Android this is pixels; on iOS it is dip.\r\n\r\nIn theory, You can use both of them. But in default, Android use pixels, and IOS use dp. ", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-30T00:14:59.000+0000", "updated": "2014-09-30T00:14:59.000+0000" }, { "id": "326239", "author": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks again Shuo.\r\n\r\nIf I do not specify the unit like this:\r\n\r\nheight: 300dp,\r\nwidth: 300dp\r\n\r\nbut do this instead\r\n\r\nheight: 300,\r\nwidth: 300\r\n\r\nWill titanium for the iphone, automatically set 'dp' as the default unit?", "updateAuthor": { "name": "maveick2k", "key": "maveick2k", "displayName": "Samie Syed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-30T00:28:42.000+0000", "updated": "2014-09-30T00:28:42.000+0000" }, { "id": "326240", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "ye, exactly. ", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-09-30T00:30:08.000+0000", "updated": "2014-09-30T00:30:08.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }