IOS7 : UIScrollView offset in UINavigationController

后端 未结 8 1944
攒了一身酷
攒了一身酷 2020-12-04 04:57

I\'m currently migrating my app on ios 7 and I\'ve been stuck for hours on the new navigationcontroller/bar management.

Before, when we had a navigation controller,

8条回答
  •  -上瘾入骨i
    2020-12-04 05:49

    OK so i found the solution, I have set in my controller the property:

    self.automaticallyAdjustsScrollViewInsets = false
    

    I don't really understand the true benefit of this property though, (or why the default value is true)

    The only documentation i found was there:

    • https://web.archive.org/web/20160405135605/https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/AppearanceCustomization.html
    • https://developer.apple.com/documentation/uikit/uiviewcontroller/1621372-automaticallyadjustsscrollviewin

    Update

    In iOS 11 automaticallyAdjustsScrollViewInsets is deprecated

    You should now use:

    self.tableView.contentInsetAdjustmentBehavior = .never
    

    I also encourage you to check this question and its answer to get a better understanding of those properties

提交回复
热议问题