[TIMOB-1986] iOS: Window properties ignored when url specified
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-07T23:48:34.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | api |
Reporter | Angus Peart |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:07:22.000+0000 |
Updated | 2017-06-07T23:48:34.000+0000 |
Description
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.
Reproducing
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'
});
mainWin.open();
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'
});
mainWin.open();
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';
Notes
In all cases, the backgroundImage property is ignored in the Ti.UI.createWindow() method.
iOS SDK: 4.0 and 4.1
Titanium Mobile: 1.4.1.1
Attachments
File | Date | Size |
---|---|---|
resources.zip | 2011-04-15T03:07:23.000+0000 | 118873 |
main.js should read
Assigning to Ralf for triage.
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).
Absolute paths work fine for droid but fail for iphone builds unfortunately.
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.
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.
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.
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.)
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: * Window view properties are not correctly set on windows opened via a URL. app.js:
js/main.js:
Closing ticket due to time passed and lack of progress or input.