{ "id": "62618", "key": "TIMOB-1986", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-07T23:48:34.000+0000", "created": "2011-04-15T03:07:22.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "api" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-07T23:48:34.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
This problem has been pointed out in Q&A here \r\nhttp://developer.appcelerator.com/question/39891/createbutton-and-b...
\r\nThe bug really needs fixing, it's nearly impossible to track down\r\nthis bug. I can't see any reason it should exist.
When using the following code the background image is shown\r\ncorrectly.
\r\nvar mainWin = Ti.UI.createWindow({\r\n //Always ignored -> backgroundImage:'images/main_background.png',\r\n url: 'javascripts/main.js'\r\n});\r\nmainWin.open();
\r\n
\r\nWhen a trailing slash is added to the url property, the\r\nbackgroundImage fails to load.
\r\nvar mainWin = Ti.UI.createWindow({\r\n //Always ignored -> backgroundImage:'images/main_background.png', \r\n url: '/javascripts/main.js'\r\n});\r\nmainWin.open();
\r\n
\r\nIn both instances the main.js file is loading\r\ncorrectly, as indicated by the backgroundColor change (contents of\r\nmain.js below)
\r\nvar win = Ti.UI.currentWindow;\r\nwin.backgroundColor = '#ffffff';
\r\n
\r\nIn all cases, the backgroundImage property is ignored in the\r\nTi.UI.createWindow() method.
\r\niOS SDK: 4.0 and 4.1
\r\nTitanium Mobile: 1.4.1.1
main.js should read
\n\nvar win = Ti.UI.currentWindow;\nwin.backgroundImage = '../images/main_background.png';\nwin.backgroundColor = '#ffffff';
\n
Assigning to Ralf for triage.
I believe this issue is more wide-reaching than simply\nbackgroundImage. Certainly, the image property of imageView also\ndoesn't work for absolute paths. See the attached project (just the\nResources dir).
Absolute paths work fine for droid but fail for iphone builds\nunfortunately.
I think I complicated this ticket with an android issue in\nerror. :/ So disregard my posts in this ticket.
\nNote that \n#2585 contains up-to-date info about paths, with an aim to\nbring consistency to the API across android and ios, which may\nultimately resolve this issue.
\nAs I am not able to test the code from the OP on iOS, I am\nrestoring the original title.
This is a fun one: At what time is the URL for the background\nimage resolved? Is it relative to the current URL, or the URL for\nthe opening window? Discuss.
If that path contains a leading slash, it's absolute from\nResources and resolution context doesn't matter. If it's relative,\nit's relative to the JS context that the opened window\ninherits/creates.