{ "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}

The Bug

\r\n

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.

\r\n

Reproducing

\r\n

When using the following code the background image is shown\r\ncorrectly.

\r\n
\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\n

When a trailing slash is added to the url property, the\r\nbackgroundImage fails to load.

\r\n
\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\n

In both instances the main.js file is loading\r\ncorrectly, as indicated by the backgroundColor change (contents of\r\nmain.js below)

\r\n
\r\nvar win = Ti.UI.currentWindow;\r\nwin.backgroundColor = '#ffffff';\r\n
\r\n

Notes

\r\n

In all cases, the backgroundImage property is ignored in the\r\nTi.UI.createWindow() method.

\r\n

iOS SDK: 4.0 and 4.1

\r\n

Titanium Mobile: 1.4.1.1

{html}", "attachment": [ { "id": "18077", "filename": "resources.zip", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:23.000+0000", "size": 118873, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Window properties ignored when url specified", "creator": { "name": "anguspeart", "key": "anguspeart", "displayName": "Angus Peart", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "anguspeart", "key": "anguspeart", "displayName": "Angus Peart", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "127188", "author": { "name": "anguspeart", "key": "anguspeart", "displayName": "Angus Peart", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

main.js should read

\n
\nvar win = Ti.UI.currentWindow;\nwin.backgroundImage = '../images/main_background.png';\nwin.backgroundColor = '#ffffff';\n
{html}", "updateAuthor": { "name": "anguspeart", "key": "anguspeart", "displayName": "Angus Peart", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:23.000+0000", "updated": "2011-04-15T03:07:23.000+0000" }, { "id": "127189", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Assigning to Ralf for triage.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:24.000+0000", "updated": "2011-04-15T03:07:24.000+0000" }, { "id": "127190", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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).

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:24.000+0000", "updated": "2011-04-15T03:07:24.000+0000" }, { "id": "127191", "author": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Absolute paths work fine for droid but fail for iphone builds\nunfortunately.

{html}", "updateAuthor": { "name": "andreassandberg", "key": "andreassandberg", "displayName": "Andreas sandberg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:24.000+0000", "updated": "2011-04-15T03:07:24.000+0000" }, { "id": "127192", "author": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I think I complicated this ticket with an android issue in\nerror. :/ So disregard my posts in this ticket.

\n

Note 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.

\n

As I am not able to test the code from the OP on iOS, I am\nrestoring the original title.

{html}", "updateAuthor": { "name": "hal", "key": "hal", "displayName": "hal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:25.000+0000", "updated": "2011-04-15T03:07:25.000+0000" }, { "id": "127193", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:25.000+0000", "updated": "2011-04-15T03:07:25.000+0000" }, { "id": "127194", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:26.000+0000", "updated": "2011-04-15T03:07:26.000+0000" }, { "id": "127195", "author": { "name": "johnwelch", "key": "johnwelch", "displayName": "John Welch", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Isn't that only true for Android? (Android doesn't have trouble\nwith absolute paths.)

\n

Based on ticket #2585 iOS does not perform the same. (I feel\nlike this ticket and #2585 are the same issues, but with different\ndescriptions.)

{html}", "updateAuthor": { "name": "johnwelch", "key": "johnwelch", "displayName": "John Welch", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:07:26.000+0000", "updated": "2011-04-15T03:07:26.000+0000" }, { "id": "209591", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Still valid in SDK 2.2.0.014b86f. Note that the bug description *is not useful* and as a result you should consider the bug to be the following:\r\n\r\n* Window view properties are not correctly set on windows opened via a URL.\r\n\r\napp.js:\r\n{code}\r\nvar mainWin = Ti.UI.createWindow({\r\n backgroundImage:'images/campFire03.gif', \r\n url: 'js/main.js'\r\n});\r\nmainWin.open();\r\n{code}\r\n\r\njs/main.js:\r\n{code}\r\nTi.UI.currentWindow.add(Ti.UI.createLabel({\r\n\ttext:'Hi!',\r\n\tcolor:'white'\r\n}));\r\n{code}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T10:05:02.000+0000", "updated": "2012-07-26T10:05:02.000+0000" }, { "id": "421344", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed and lack of progress or input.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-07T23:48:34.000+0000", "updated": "2017-06-07T23:48:34.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }