[TIMOB-7612] iOS: TableView doesn't support percentage heights when layout is 'vertical'.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-04-02T16:06:37.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2012-05, Release 2.0.0 |
Components | iOS |
Labels | module_tableview, parity, qe-testadded |
Reporter | Arthur Evans |
Assignee | Neeraj Gupta |
Created | 2012-02-10T10:42:51.000+0000 |
Updated | 2013-12-10T06:10:19.000+0000 |
Description
Title says it all. Test case follows:
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
layout: 'vertical'
});
var tableView = Ti.UI.createTableView({
//top: 0,
height: '90%',
width: '100%'
});
var rows = [];
var row;
for (var i=0;i<100;i++) {
row = Ti.UI.createTableViewRow({
title: 'Row #' + i
});
rows.push(row);
}
tableView.data = rows;
win1.add(tableView);
var buttonContainer = Ti.UI.createView({
//bottom: 0,
width: '100%',
height: '10%',
backgroundColor: '#99f',
});
var bottomButton = Ti.UI.createButton({
title: "Scroll to Bottom",
width: '50%',
height: '100%',
right: 0
});
var topButton = Ti.UI.createButton({
title: "Scroll to Top",
width: '50%',
height: '100%',
left: 0
});
buttonContainer.add(topButton);
buttonContainer.add(bottomButton);
win1.add(buttonContainer);
win1.open();
tableView.addEventListener('scrollEnd', function(evt) {
Ti.API.info("Done scrolling.");
});
topButton.addEventListener('click', function(evt) {
Ti.API.info("Scrolling to top.");
tableView.scrollToIndex(0);
});
bottomButton.addEventListener('click', function(evt) {
Ti.API.info("Scrolling to bottom.");
tableView.scrollToIndex(99);
});
As written, it displays properly on Android. When run on iOS, the table view is invisible and the buttons are squished up off the top of the screen.
If you comment out the layout
property in TableView and uncomment the top
and bottom
properties for the table view and the button container, it runs properly on iOS.
Resolved by new composite layout behavior spec
Closing issue Tested with Ti Studio build 2.0.0.201203202130 Ti Mob SDK 2.0.0.v20120321071752 hash r4c936bac OSX Lion 10.7.3 iPhone 4S OS 5.0.1 Table view is visible with vertical layout
Reopening/closing to add/remove labels
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5003