I am trying to implement pagination in my UITableView. My cells heights are pretty much fullscreen, code here:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return ([[UIScreen mainScreen] bounds].size.height) - (self.navigationController.navigationBar.frame.size.height)-20;
}
I have set paging enabled in the interface builder however the offset is slightly wrong. I guess this is because it uses the size of the window frame as its offset. Is there anyway I can adjust this to match my table cell heights? Any tips would be really appreciated.
If TabBar or bottom of the view is covering the TableView cells then use following code in -viewDidLoad: method
self.edgesForExtendedLayout = UIRectEdgeAll;
// self.tableView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, CGRectGetHeight(self.tabBarController.tabBar.frame), 0.0f);
self.tableView.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, 75.0f, 0.0f);
If you want to present the top of your table view when it appears the use following code in -viewWillAppear: method
[self.tableView reloadData];
self.tableView.contentOffset = CGPointMake(0, 0 - self.tableView.contentInset.top);
Hope you find your answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With