jxdwinter jxdwinter - 1 year ago 123
iOS Question

UITabBar will hide the last cell of the UITableView

self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height ) style:UITableViewStylePlain];

enter image description here

If I change the tableview frame to

(0.0, 0.0, 320.0, [UIScreen mainScreen].bounds.size.height -49.0)

enter image description here

the scroll bar will leave a blank,I do not like it.How can I fix this?

Thank you very much.

Answer Source

You could try setting the contentInset of that table view. In iOS 7 there's a topLayoutGuide and bottomLayoutGuide (which is what you want). Inside of a UITabBarController the bottomLayoutGuide should give you the height of the bottom bar basically.

tableView.contentInset = UIEdgeInsetsMake(0, 0, self.bottomLayoutGuide.length, 0);

should do the trick.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download