More than one horizontal view
Closed this issue · 6 comments
quite simply, is it possible to have more than one horizontal tableview?
i need to have two and they should be able to slide independently. it doesn't seem to work when i try to create two horizontals. one is slideable the other is not.
kim
You can have any number of horizontally scrolling EasyTableViews, or vertically for that matter. That's what the sample code demonstrates (one vertical and one horizontal). Check your code. I'm pretty sure you may have done something wrong.
thank you for answering so fast. i'm new to ipad development so my question my seem very basic. but im a bit confused.
if i create horizontal1 and horizontal2 won't they get created in exactly the same row/column on the screen since the create method uses the same xOrigin and yOrigin?
kim
i have done a bit more research.
starting point is your code - no changes. everything works.
if i substitute:
tableView = [[UITableView alloc] initWithFrame:CGRectMake(xOrigin, yOrigin, self.bounds.size.height, self.bounds.size.width)];
with
tableView = [[UITableView alloc] initWithFrame:CGRectMake(314, -375, self.bounds.size.height, self.bounds.size.width)];
it moves the horizontal scroller approximately half its own hight from the bottom. when i try to drag the scrolller from the upper half i cant scroll it. but if i try from the lower half it scrolls. it's like there is some kind of overlay that i dont know how to move together with the scroller. do you follow me? i guess there's something in the code i don't understand.
can you guide me?
kim
I would not modify EasyTableView if you do not know what you are doing. Go to EasyTableViewController and substitute the following code for setupVerticalView. This demonstrates two horizontally scrolling table views:
-
(void)setupVerticalView {
CGRect frameRect = CGRectMake(0, 0, PORTRAIT_WIDTH, HORIZONTAL_TABLEVIEW_HEIGHT);
self.verticalView = [[EasyTableView alloc] initWithFrame:frameRect numberOfColumns:NUM_OF_CELLS ofWidth:VERTICAL_TABLEVIEW_WIDTH];verticalView.delegate = self;
verticalView.tableView.backgroundColor = TABLE_BACKGROUND_COLOR;
verticalView.tableView.allowsSelection = YES;
verticalView.tableView.separatorColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
verticalView.cellBackgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
verticalView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;// Allow verticalView to scroll up and completely clear the horizontalView
//verticalView.tableView.contentInset = UIEdgeInsetsMake(0, 0, HORIZONTAL_TABLEVIEW_HEIGHT, 0);[self.view addSubview:verticalView];
[verticalView release];
}
Thanks a lot. Exactly what i was looking for.
saved my day.
Kim
Glad you got it working!