[TIMOB-2991] iOS Bug: ScrollView can't carry 2 tableviews
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-15T03:34:19.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | bug, in, ios, scrollview, tableview |
Reporter | Alan Leard |
Assignee | Blain Hamon |
Created | 2011-04-15T03:34:19.000+0000 |
Updated | 2017-03-29T15:55:26.000+0000 |
Description
If a user has 2 tableViews that they want to scroll through as a Grouped tables, one and then the other. Scrollview either does not scroll, or puts one table on top of the other.
Ticket Reference: http://developer.appcelerator.com/helpdesk/view/68531">http://developer.appcelerator.com/helpdesk/view/68531
Test Code:
var win = Ti.UI.createWindow();
var view = Ti.UI.createView({});
var scrollView = Ti.UI.createScrollView({
contentHeight:'auto',
contentWidth:'auto',
top:0,
opacity:0.5
});
var table1 = Ti.UI.createTableView({
style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
top:0
});
var table2 = Ti.UI.createTableView({
style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
top:0
});
var count = 20;
var data = [];
for (var c=0;c<count;c++)
{
var row = Ti.UI.createTableViewRow({title:"Row "+(c+1)});
data[c] = row;
}
table1.data = data;
var inputData = [
{title:'row 1', header:'Header 1'},
{title:'row 2'},
{title:'row 3'},
{title:'row 4', header:'Header 2'},
{title:'row 5'}
];
table2.data = inputData;
scrollView.add(table2);
scrollView.add(table1);
win.add(scrollView);
win.open();
1) The code asks for the scrollable height to be '100%'. 100% of what is undefined, so it's likely 0, and rounded up to the viewable area, making the scroll view, er, scrollless.
2) The scrollview hasn't been assigned a layout, so absolute is the default.
3) Even if vertical layout was used, the height of the table views were not specified, and would fill up the parent container by default.
4) The auto height of a table view is undefined because of how rows work at the OS level.
5) Similarly, trying to lay it all out inside a scrollview is prohibitively expensive because it robs the table view of view recycling.
6) Because of this, each table view scrolls by itself independently. That's what they do.
7) So if you want two tableviews acting as one, use only one tableview. No scrollview needed.
Closing ticket as invalid.