Content pushed down in a UIPageViewController with UINavigationController

后端 未结 15 635
暗喜
暗喜 2020-12-12 18:05

UPDATE 2

I\'ve been running and testing my app in the iOS Simulator using a 4-inch device. If I run using a 3.5-inch device the label doesn\'t jump.

15条回答
  •  一生所求
    2020-12-12 18:47

    So I'm adding another answer after further development and I finally think I figured out what's going on. Seems as though in iOS7, UIPageViewController has its own UIScrollView. Because of this, you have to set automaticallyAdjustsScrollViewInsets to false. Here's my viewDidLoad now:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        self.automaticallyAdjustsScrollViewInsets = false;
    
        DetailViewController *detail = [[DetailViewController alloc] init];
        [self setViewControllers:@[detail]
                       direction:UIPageViewControllerNavigationDirectionForward
                        animated:false
                      completion:nil];
    }
    

    No need to put anything in viewWillLayoutSubviews (as one of my previous answers suggested).

提交回复
热议问题