iDia
iDia

Reputation: 1397

UITableview not visible the last cell when scroll down

I'm very new to iOS. I have a UITableView that filled with many custom cells, but the bottom cell is is not visible properly when scroll down.my Y value of the UITableView is 44 and Height is 480. Only the half of the last cell is visible when scroll down. How can I fixe this problem.

Thanks in advance.

Upvotes: 20

Views: 21290

Answers (5)

rishi
rishi

Reputation: 11839

Use -

  tableView.contentInset = UIEdgeInsetsMake(0, 0, 120, 0); //values

passed are - top, left, bottom, right

Pass bottom offset as per your needs.

Upvotes: 75

Narasimha Nallamsetty
Narasimha Nallamsetty

Reputation: 1263

For me this is worked.

I have commented out my code

-(void)viewWillLayoutSubviews
{
dispatch_async(dispatch_get_main_queue(), ^{
    //This code will run in the main thread:
    CGRect frame = tableViewObj.frame;
    frame.size.height = tableViewObj.contentSize.height;//commenting this code worked.
    tableViewObj.frame = frame;

});

}

That's it. It worked for me. Please make sure you have not changed tableview frame some where while in implementation file.

Upvotes: 1

ebi
ebi

Reputation: 4902

If you are on iOS7 and using a navigation controller toolbar, make sure to set it to translucent:

    self.navigationController.toolbar.translucent = NO;

Upvotes: 0

jianpx
jianpx

Reputation: 3330

it is because you set your tableview's frame wrong, if your view has a navigation bar , usually use this code:

CGRect frame = self.view.bounds;
frame.height -= 44;

44 is the height of your navigation bar.

Upvotes: 5

ashokbabuy
ashokbabuy

Reputation: 1000

If you have a status bar visible on the top, then it will occupy 20px which will push down your tableView by the same. To avoid this, make the tableView height 460 instead of 480.

Upvotes: 1

Related Questions