Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tableView.contentInset broken on iOS 7

Setting the contentInset on a UITableView doesn't seem to work on iOS 7:

self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0); 
// Works on iOS 6, nothing happens on iOS 7

I've tried setting self.automaticallyAdjustsScrollViewInsets to NO in viewDidLoad, still nothing.

What am I doing wrong? Is there a new way to do this or a workaround?

like image 430
nathan Avatar asked Sep 23 '13 05:09

nathan


1 Answers

Moving this code into the view controller's -viewDidLayoutSubviews method fixed this for me.

-(void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0); 
}

Thanks Apple for your non-existent documentation on this!

like image 157
nathan Avatar answered Sep 23 '22 10:09

nathan