iPhone tableview hidden if child view
So I've distilled this down to the following failure case: one simple app.js - using mobilesdk 1.4.1.1 on OS X 10.6.4 - Developer 1.2.1
var i_want_to_see_my_table_on_iPhone = 1;
var mainView = Titanium.UI.createView({
width:'auto',
height:'auto',
left:0,
right:0});
var data = [];
data.push(Ti.UI.createTableViewRow({title:"Row 1"}));
data.push(Ti.UI.createTableViewRow({title:"Row 2"}));
var tableView = Titanium.UI.createTableView({data:data});
var window = Titanium.UI.createWindow({title:"TableView test",
backgroundColor:"#fff"});
mainView.add(tableView);
if (i_want_to_see_my_table_on_iPhone == 0) window.add(mainView);
else window.add(tableView);
window.open();
if you set the flag variable to 0, the tableView on iPhone is hidden - in other words, for the table view to show up, it must be the only view added to the window object, not a child of some other view.
works on android regardless of the setting of the flag.
1 Answer
-
I've noticed this bug on sdk 1.8.0.1 however in my case it shows the table the majority of the time but sometimes randomly fails to draw it to the window. The only workaround I've found is to make sure the table is not a child view.