iOS7 View moves under status/nav bars when loadView called again

前端 未结 6 862
遇见更好的自我
遇见更好的自我 2021-02-13 03:57

I have a View Controller that creates its view programatically through the loadView method. The purpose of the view is to display a data models contents. When the v

6条回答
  •  感情败类
    2021-02-13 05:00

    I think the problem is due to incorrect automatic set of content insets of the scrollview.

    Try the following. In your loadView, set self.automaticallyAdjustsScrollViewInsets to NO (only if NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1). Now, set the contentInset and scrollIndicatorInsets to the correct values depending on OS version:

    scrollview.contentInset = scrollview.scrollIndicatorInsets = UIEdgeInsetMake(NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1 ? 0 : 64, 0, 0, 0);
    

提交回复
热议问题