Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13177] iOS: Parity - view properties are not applying correctly on iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2013-03-25T20:46:35.000+0000
Affected Version/sRelease 3.1.0
Fix Version/s2013 Sprint 07 API, 2013 Sprint 07
ComponentsiOS
Labelsios, parity, qe-sdk3.1.0
ReporterOlga Romero
AssigneeBlain Hamon
Created2013-03-23T19:56:05.000+0000
Updated2013-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.

Comments

  1. Vishal Duggal 2013-03-25

    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.
  2. Blain Hamon 2013-03-27

  3. Eric Merriman 2013-04-01

    So are we closing as won't fix?

JSON Source