[TIMOB-7203] iOS: UI.View - make size property read-only
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2012-01-17T08:38:36.000+0000 |
| Affected Version/s | Release 1.8.0.1 |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | parity |
| Reporter | Paul Dowsett |
| Assignee | Neeraj Gupta |
| Created | 2012-01-16T09:39:38.000+0000 |
| Updated | 2017-03-09T23:14:28.000+0000 |
The above test case proves that the size property is read-only. Closing as invalid.
Note that the behavior is the same for Android, although there are bugs presently that mean that size is not correct unless the window is heavyweight, view is already rendered, used within an window open event and the first open event is ignored, as per the following code:
var win = Ti.UI.createWindow({ fullscreen:false, backgroundColor:'red' }); var view = Ti.UI.createView({ backgroundColor:'blue', width:50, height:50 }); win.add(view); win.open(); var openEventCount = 0; win.addEventListener('open', function() { openEventCount++; Ti.API.info("------- Window event fired: open --------"); if(openEventCount === 2){ Ti.API.info("*** Before width changes 50 ***"); Ti.API.info("view.size w x h: " + view.size.width + " x " + view.size.height); Ti.API.info("view w x h: " + view.width + " x " + view.height); Ti.API.info("*** view.size.width change 100 ***"); view.size.width = 100; // this should NOT work Ti.API.info("view.size w x h: " + view.size.width + " x " + view.size.height); Ti.API.info("view w x h: " + view.width + " x " + view.height); Ti.API.info("*** view.width change 200 ***"); view.width = 200; // this should work Ti.API.info("view.size w x h: " + view.size.width + " x " + view.size.height); Ti.API.info("view w x h: " + view.width + " x " + view.height); } });In case a race condition is involved, I wrapped a setTimeout around the logging lines, and confirmed view.size.width value is read-only. Hence, closing.
Closing ticket as invalid.