在故事板中,我的UINavigationController
没有导航栏,而且根视图控制器UIPageViewController
有两个孩子:LoginVC和ChoosePlaceVC。UIPageViewController中的奇怪约束行为
MainPageVC是UIPageViewController的一个简单的子类,我只是设置
[self setViewControllers:@[loginVC] direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
在登录视图控制器我设置约束到顶部的标志形象的标志0(距离屏幕的顶部0 )。但是,当我看到它第一次从状态栏的distance为20,只有当我去下一个VC在UIPageViewController(weakSelf是弱引用自定义UIPageViewController):
[weakSelf setViewControllers:@[choosePlaceVC] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
}];
,然后返回登录VC:
[weakSelf setViewControllers:@[loginVC] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
}];
徽标到状态栏的距离becomes 0。当我重复移动到下一个VC并返回时,距离保持= 0(这是正确的距离)
为什么第一次出现距离= 20?