self.automaticallyAdjustsScrollViewInsets = YES;
I set that to yes. I think it's yes by default.
Then when I check the inset this is what I got: NSStringFromUIEdgeInsets(self.tableView.contentInset): {0, 0, 0, 0}
I thought it should be set up in a way that incorporate the navigationBar and statusbar. So what happened?
From what I know
automaticallyAdjustsScrollViewInsets
allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar
edgesForExtendedLayout
is UIEdgeRectTop
(if you want the ScrollView
subclass view to be behind the top bar), UIEdgeRectBottom (if you want
the ScrollView subclass view to be behind the bottom bar)The code below replicates what automaticallyAdjustsScrollViewInsets
does when edgesForExtendedLayout = UIEdgeRectTop
self.scrollView.contentInset = UIEdgeInsetsMake(self.topLayoutGuide.length, 0, 0, 0);
self.scrollView.contentOffset = CGPointMake(0, -self.topLayoutGuide.length);