在 ios7 上运行我的应用程序时,我注意到我的子视图控制器有一个从其父视图控制器的导航栏开始的起点,而在 ios6 上并非如此。
这是我在添加子视图控制器时使用的代码:
- (void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    if (!self.selectionBarViewController) //self.selectionBarViewController is the child view controller
    {
        self.selectionBarViewController = [[UCIScrollSelectionBarViewController alloc] init];
        self.selectionBarViewController.view.frame = CGRectMake(0.0f,
                                                                0.0f,
                                                                self.view.frame.size.width,
                                                                44.0f);
        self.selectionBarViewController.dataSource = self;
        self.selectionBarViewController.delegate = self;
        [self addChildViewController:self.selectionBarViewController];
        [self.view addSubview:self.selectionBarViewController.view];
        [self.selectionBarViewController didMoveToParentViewController:self];
        [self.selectionBarViewController beginAppearanceTransition:YES
                                                          animated:YES];
    }
    //More set up code here
}
当我调整子视图控制器的框架时,我可以看到它,但理想情况下,如果用户从 iOS 6 或 7 运行应用程序,我不希望有条件布局代码。