[TIMOB-2910] iOS / iPad: setData in anything post 1.4.x flickers
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T02:00:25.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M08 |
Components | iOS |
Labels | ios, quickstart-customer, regression, release-1.6.0, rplist, tableview |
Reporter | Rick Blalock |
Assignee | Ralf Pfeiffer |
Created | 2011-04-15T03:32:39.000+0000 |
Updated | 2011-04-17T02:00:25.000+0000 |
Description
setData() sometimes performs strange when using it in conjunction with a window focus event.
There have been a few reports of flickering and other odd
behaviors on the q/a forums, i.e.:
http://developer.appcelerator.com/question/91471/updating-table-on-window-focus">
http://developer.appcelerator.com/question/91471/updating-table-on-...
http://developer.appcelerator.com/question/92611/tableview-rendering-async-since-150">
http://developer.appcelerator.com/question/92611/tableview-renderin...
In the specific case of a quickstart customer I am assisting, table row contents flicker when setData is called on a window focus event. Attached is a video to show you what it is doing.
His code is fairly abstracted out but here are some examples of his code: http://pastie.org/1485195">http://pastie.org/1485195
Most of his custom methods for creating rows, etc. are just wrappers for native Ti code. Nothing magical going on in the background - just stuff to help him manage the app. I can provide that if you need it.
Using the sample code below - on the sim the label positioned on the right hand side jumps over to the right - http://screencast.com/t/nsqmRxa37Z">http://screencast.com/t/nsqmRxa37Z. On the device this does not happen but a black area flickers for a short bit. (see attached video)
Below is some sample code to run. It doesn't duplicate some of the issues exactly but does still show a few oddities (in both the sim and device) as mentioned above:
var win = Titanium.UI.currentWindow;
var rows = [];
var tableview = Ti.UI.createTableView();
for (var i=0; i < 10; i++) {
var row = Ti.UI.createTableViewRow({
left: 0,
top: 0,
height: 50,
width: '100%',
separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.NONE,
backgroundColor: 'transparent',
color: 'Red',
selectedBackgroundImage: ''
});
var label = Ti.UI.createLabel({top: 10, left: 10, height: 22, width: 100, color: '#444', text: 'sometext', font: {fontFamily: 'Helvetica Neue', fontSize:20, fontWeight:'bold'}, textAlign: 'left'});
var label2 = Ti.UI.createLabel({top: 10, right: 10, height: 22, width: 100, color: '#444', text: 'sometext', font: {fontFamily: 'Helvetica Neue', fontSize:20, fontWeight:'bold'}, textAlign: 'left'});
row.add(label);
row.add(label2);
rows.push(row);
};
var button = Ti.UI.createButton({
title: "setData",
width: 50,
height: 50,
top: 10,
right: 10
});
win.addEventListener('focus', function() {
setTimeout(function() {
tableview.setData(rows);
}, 1000);
});
button.addEventListener('click', function() {
tableview.setData(rows);
});
tableview.addEventListener('click', function() {
var newwin = Ti.UI.createWindow({
title: 'New window',
url: 'test.js'
});
Ti.UI.currentTab.open(newwin, { animated: true });
});
win.add(tableview);
win.add(button);
Attachments
File | Date | Size |
---|---|---|
img_0587.MOV | 2011-04-15T03:32:40.000+0000 | 1791536 |
img_0588.MOV | 2011-04-15T03:32:39.000+0000 | 1395523 |
Having problems trying to recreate this. Some of this may be due to fixes that have happened since the bug was logged.
This hasn't been an issue since early last week in the latest builds. I actually thought you fixed this since it was working last week.
Hunh. I figured it might have been the case, but knowing how bugs can be interrelated or have common roots, I didn't have this bug in mind when fixing the others. If the issue has gone away for you, shall we call this one fixed-in-qa?
Yes I think that's safe to do. I haven't tested with the build today but it worked all week last week. I suppose it'd be good to know that fixed it to avoid regression issues.
This still doesn't work in 1.6.1...whenever you call setData on a tableView...the entire table flickers really bad. On an iPhone 3G it's even worse. The workaround everyone is using is the following:
tableView.hide();
tableView.setData(data);
setTimeout(function() {
tableView.show(); },50);
But unfortunately this workaround won't work for my app....please re-open this bug. It's a really ugly one that seems to have around for a while now.
I created a new ticket that has a better example of the issue:
https://appcelerator.lighthouseapp.com/projects/32238/tickets/3407-tableview-with-dynamic-row-height-causes-really-bad-flickering"> https://appcelerator.lighthouseapp.com/projects/32238/tickets/3407-...