I am trying to create programmatically a uitableview that can scroll and fit based on the number of cells, so if i am adding more cells, i could scroll up and down without the page bouncing.
I tried to do this but it doesnt work:
tblSimpleTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 640) style:UITableViewStyleGrouped ];
tblSimpleTable.scrollEnabled = YES;
tblSimpleTable.dataSource = self;
tblSimpleTable.delegate = self;
[self.view addSubview:tblSimpleTable];
when i add more cells, i can scroll up and down, but the page bounces up so i can’t click on the bottom cells. I want to be able to scroll and “stay” where i stop.
UPDATE: just to clarify, since I am using a Grouped table, i dont want to show empty cells, and so i am not sure what should be the height of the able since i may have 1 cell or 100 of them.
Thanks!
The reason you aren’t staying where you stop is because your UITableView’s height is 640. This means that when you completely scroll all the way down in your UITableView some of the cells will be below the bounds of the view you are looking through. You have two options: decrease your table view height, or add some dummy cells to the bottom of your table view.