Dave
Dave

Reputation: 4048

UITableView manual scrolling to the last row

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?

Upvotes: 0

Views: 3625

Answers (5)

barryjones
barryjones

Reputation: 2309

The easiest way is to set this [statusMessagesTableView setContentInset:UIEdgeInsetsMake(0, 0, 80, 0)];

Upvotes: 0

Vijay
Vijay

Reputation: 1016

Use this

tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,50,320,320)style:UITableViewStylePlain];

Put whatever height as you want.

Upvotes: 0

Jonah
Jonah

Reputation: 4800

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)

Upvotes: 2

Dave
Dave

Reputation: 4048

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

-[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.

Upvotes: 2

Ben Gottlieb
Ben Gottlieb

Reputation: 85532

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

Upvotes: 2

Related Questions