Probably it was some sort of my mistake because of me messing with autolayouts and storyboard but I found an answer.
You have to take care of this little guy in View Controller's Attribute Inspector
It must be unchecked so the default contentInset
wouldn't be set after any change.
After that it is just adding one-liner to viewDidLoad
:
[self.tableView setContentInset:UIEdgeInsetsMake(108, 0, 0, 0)]; // 108 is only example
iOS 11, Xcode 9 update
Looks like the previous solution is no longer a correct one if it comes to iOS 11 and Xcode 9. automaticallyAdjustsScrollViewInsets
has been deprecated and right now to achieve similar effect you have to go to Size Inspector where you can find this:
Also, you can achieve the same in code:
if #available(iOS 11.0, *) {
scrollView.contentInsetAdjustmentBehavior = .never
} else {
automaticallyAdjustsScrollViewInsets = false
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…