[TIMOB-8938] iOS: TableView height Ti.UI.SIZE is not working on Titanium 2.0.1GA2 SDK
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-05-09T13:10:15.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | Release 2.1.0, Sprint 2012-10 Core |
Components | iOS |
Labels | core, module_tableview, qe-testadded |
Reporter | Varun Joshi |
Assignee | Stephen Tramer |
Created | 2012-04-30T18:03:30.000+0000 |
Updated | 2012-12-10T18:08:34.000+0000 |
Description
Setting the height of a tableview to Ti.UI.Size should scale the tableview to it's minimum height. In Titanium 2.0, this feature does not work. The tableview will be scaled to maximum.
Sample Code 1
Take the kitchensink example, "tableview_layout_3.js" and set "height : Ti.UI.Size" where tableview variable is declared.
Sample Code 2
{noformat}
/ 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 : 'red',
layout : 'vertical'
});
var tab1 = Titanium.UI.createTab({
icon : 'KS_nav_views.png',
title : 'Tab 1',
window : win1
});
var label1 = Titanium.UI.createLabel({
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
color : '#999',
text : 'I am a label on top of the page',
font : {
fontSize : 20,
fontFamily : 'Helvetica Neue'
},
textAlign : 'center',
});
win1.add(label1);
// create an array of anonymous objects
var tbl_data = [{
title : 'Row 1'
}, {
title : 'Row 2'
}, {
title : 'Row 3'
}];
// now assign that array to the table's data property to add those objects as rows
var tvTest = Titanium.UI.createTableView({
height : Ti.UI.SIZE,
data : tbl_data,
backgroundColor : '#FFFFFF'
});
win1.add(tvTest);
var label2 = Titanium.UI.createLabel({
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
color : '#999',
text : 'I am a label underneath the tableview',
font : {
fontSize : 20,
fontFamily : 'Helvetica Neue'
},
textAlign : 'center',
width : 'auto'
});
win1.add(label2);
//
// add tab
//
tabGroup.addTab(tab1);
// open tab group
tabGroup.open();
{noformat}
The tableview in the above code is not visible.
Comments
JSON Source
The rowHeight in the above code was not used that has to be used to create a dynamic table. Using rowHeight fixed the issue.
Resolved by PR https://github.com/appcelerator/titanium_mobile/pull/2153
Closing issue Tested with Ti Studio build 2.1.0.201206211609 Ti Mobile SDK 2.1.0.v20120622174154 hash rdc9dfbe5 OSX Lion 10.7.3 iPhone 4S OS 5.1 Verified expected behavior is shown
TableView height calculations are still INACCURATE when any of these are used in the TableView: HeaderView, FooterView, SectionHeaderView, SectionFooterView. Please re-confirm behavior.
I can confirm that Young is correct. Ti.UI.SIZE doesn't work if you have HeaderViews.