Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7612] iOS: TableView doesn't support percentage heights when layout is 'vertical'.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-04-02T16:06:37.000+0000
Affected Version/sn/a
Fix Version/sSprint 2012-05, Release 2.0.0
ComponentsiOS
Labelsmodule_tableview, parity, qe-testadded
ReporterArthur Evans
AssigneeNeeraj Gupta
Created2012-02-10T10:42:51.000+0000
Updated2013-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.

Comments

  1. Allen Yeung 2012-03-20

    Resolved by new composite layout behavior spec
  2. Michael Pettiford 2012-03-21

    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
  3. Michael Pettiford 2012-04-02

    Reopening/closing to add/remove labels
  4. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5003

JSON Source