[TIMOB-13177] iOS: Parity - view properties are not applying correctly on iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2013-03-25T20:46:35.000+0000 |
Affected Version/s | Release 3.1.0 |
Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
Components | iOS |
Labels | ios, parity, qe-sdk3.1.0 |
Reporter | Olga Romero |
Assignee | Blain Hamon |
Created | 2013-03-23T19:56:05.000+0000 |
Updated | 2013-04-01T20:56:50.000+0000 |
Description
Tapping the button shows the view flickering not just from top left to bottom right as it should be, but random places.
Description:
1. Run the following code:
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
// create base UI tab and root window
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
var viewy = Ti.UI.createView({width:100, height:100, top: 50, left: 50, backgroundColor:'#f00'});
function doWork(){
viewy.applyProperties({top:150,left:150});
viewy.applyProperties({top:50,left:50});
}
win1.add(viewy);
var btn1 = Ti.UI.createButton({width:200,height:60,left:10,top:410,title:'Test!'});
win1.add(btn1);
btn1.addEventListener('click',function(){
label1.text = 'Testing...';
var startTime = Date.now();
for(i=0;i<1000;i++){
doWork();
}
var endTime = Date.now();
label1.text = 'This command USED TO take '+(endTime-startTime)+' microsecs.';
Ti.API.debug(label1.text);
})
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
2. Tap on "Test!" button
Actual result:
2. The view is flickering allover the screen
Expected result:
2. The view should flicker from top left to bottom right on each tap.
applyProperties does not guarantee a sync with the UI thread. Essentially the way the code is written, when the UI thread kicks in to relayout the view can be at any of the 4 possible positions (50,50), (50,150), (150, 50) or (150,150) The fact that the view always returns to (50,50) proves that applyProperties is in fact working correctly.
So are we closing as won't fix?