views:

43

answers:

2

I have a view which consists of a tableview and a navigation bar. For my tableview I have implemented a 'Load more' row which will load current + pagesize every time it is clicked

The way the loading works is very simple, every time it is clicked I just request the amount of rows I want to display e.g. 5, 10, 15 and so on. This request populates an array and I call

[self.tableView reloadData]

The issue I am experiencing is that when I go to the tableview the first time, it correctly loads and displays the tableview. However, if I 'Load more' it returns the correct amount and displays the correct number of cells but the last cell will not fit properly at the bottom of the screen, about 1/2 of it (or roughly the size of the navigation bar of the cell) appears below the bottom of the screen.

I thought it was sufficient to just tell the tableview to reload itself. Do I need to use

[self.tableView insertRowsAtIndexPaths ...]

to do this.

+1  A: 

Check the frame of your tableview...its probably too big and therefore its getting cut off

Daniel
I have the 'load more' configurable. If I tell it to load all the rows, it all looks fine. The problem only occurs when I repopulate the array and tell it to reloadData
Liam
+1  A: 

After you load more, does your scroll bar stop at the bottom of your table, the way it should work, or does it look like the scrollbar scrolls past the bottom of the table? If the scrollbar scrolls past the bottom of the table, then Daniel is right and your tableView's frame is somehow changing and becoming too large to fit on screen. If the scrollbar stops where it should, then your tableView's frame is fine, but for whatever reason the tableView is not correctly calculating it's own contentSize.

Do you implement this method:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

in your tableview's delegate? If so, my guess is you are not specifying the correct size of your table cells. Is the load more cell the same size your other cells?

Gotosleep
+1 for getting me to stop making assumptions and check the obvious
Liam