Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1986] iOS: Window properties ignored when url specified

GitHub Issuen/a
Resolution Date2017-06-07T23:48:34.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ReporterAngus Peart
AssigneeIngo Muschenetz


The Bug

This problem has been pointed out in Q&A here http://developer.appcelerator.com/question/39891/createbutton-and-backgroundimage"> http://developer.appcelerator.com/question/39891/createbutton-and-b...
The bug really needs fixing, it's nearly impossible to track down this bug. I can't see any reason it should exist.


When using the following code the background image is shown correctly.

var mainWin = Ti.UI.createWindow({
  //Always ignored -> backgroundImage:'images/main_background.png',
  url: 'javascripts/main.js'

When a trailing slash is added to the url property, the backgroundImage fails to load.

var mainWin = Ti.UI.createWindow({
  //Always ignored -> backgroundImage:'images/main_background.png', 
  url: '/javascripts/main.js'

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

var win = Ti.UI.currentWindow;
win.backgroundColor = '#ffffff';


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

iOS SDK: 4.0 and 4.1

Titanium Mobile:




  1. Angus Peart 2011-04-15

    main.js should read

       var win = Ti.UI.currentWindow;
       win.backgroundImage = '../images/main_background.png';
       win.backgroundColor = '#ffffff';
  2. Don Thorp 2011-04-15

    Assigning to Ralf for triage.

  3. hal 2011-04-15

    I believe this issue is more wide-reaching than simply backgroundImage. Certainly, the image property of imageView also doesn't work for absolute paths. See the attached project (just the Resources dir).

  4. Andreas sandberg 2011-04-15

    Absolute paths work fine for droid but fail for iphone builds unfortunately.

  5. hal 2011-04-15

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

    Note that https://appcelerator.lighthouseapp.com/projects/32238-titanium-mobile/tickets/2585"> #2585 contains up-to-date info about paths, with an aim to bring consistency to the API across android and ios, which may ultimately resolve this issue.

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

  6. Stephen Tramer 2011-04-15

    This is a fun one: At what time is the URL for the background image resolved? Is it relative to the current URL, or the URL for the opening window? Discuss.

  7. Don Thorp 2011-04-15

    If that path contains a leading slash, it's absolute from Resources and resolution context doesn't matter. If it's relative, it's relative to the JS context that the opened window inherits/creates.

  8. John Welch 2011-04-15

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

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

  9. Stephen Tramer 2012-07-26

    Still valid in SDK Note that the bug description *is not useful* and as a result you should consider the bug to be the following: * Window view properties are not correctly set on windows opened via a URL. app.js:
       var mainWin = Ti.UI.createWindow({
         url: 'js/main.js'
  10. Lee Morris 2017-06-07

    Closing ticket due to time passed and lack of progress or input.

JSON Source