views:

332

answers:

3

I have a table view controller which doesn't let me manually scroll to the last row. It automatically scrolls slightly up so I could never select the last 2-3 rows. Anyone experienced this problem? Should I set a minimum height for the table view to solve this? If so how?

+2  A: 

Are you able to scroll using touches to the last row? It may be a contentSize issue.

Ben Gottlieb
no i am unable to scroll using touches. how do i set contentSize?
Dave
i set a minimum height for the table view content size to 600. No change in the behavior.
Dave
if you're not manually setting contentSize, don't start now. Have you verified that the table's frame is correct, and what you expect? ie, if it's extending either offscreen or below another view, you'll get the behavior you describe above.
Ben Gottlieb
+2  A: 

The first answer in the following post helped me fix this issue -

http://stackoverflow.com/questions/478931/uitableview-scrolltorowatindexpath-scrolls-but-goes-back-to-1st-row

The initial CGSize for the UiTableView was set at a higher value (beyond the view bounds) and that was the issue. I upvoted that answer. Thanks.

Dave
+2  A: 

Likely your tableView frame is too big and extends off the screen. This will prevent the bottom cells from being able to scroll up to the screen because they've reached the bottom of the tableView.

You will have to determine the visible area on your screen. But the code should look something like this:

self.tableView.frame = CGRectMake(0.0, 0.0, 320, 324);

Here's the meanings of the CGRectMake values: (X, Y, Width, Height)

Jonah