2

我有一个 UIViewController,其中另一个 viewcontroller(1) 和 splitviewcontroller(2) 通过 addchildviewcontroller 方法进行切换。因此,当我添加 splitviewcontroller 时,它无法处理正确的旋转。看视频——https://dl.dropbox.com/u/2139277/IMG_0180.MOV

这是进行切换的代码:

- (void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController
{
    if (fromViewController == toViewController)
        return;
    // animation setup
    toViewController.view.frame = self.view.bounds;
    // notify
    [fromViewController willMoveToParentViewController:nil];
    [self addChildViewController:toViewController]; 
    // select animation direction
    UIViewAnimationOptions animation = (_contentState == ContentStateViewingMap) ? UIViewAnimationOptionTransitionCurlUp : UIViewAnimationOptionTransitionCurlDown;
    // transition
    ContentState previousState = _contentState;
    _contentState = ContentStateAnimating;
    [self transitionFromViewController:fromViewController
                      toViewController:toViewController
                              duration:0.6
                               options:animation | UIViewAnimationOptionCurveEaseInOut
                            animations:nil
                            completion:^(BOOL finished) {
                                [toViewController didMoveToParentViewController:self];
                                [fromViewController removeFromParentViewController];
                                _contentState = (previousState == ContentStateViewingMap) ? ContentStateViewingList : ContentStateViewingMap;
                            }];
}
4

1 回答 1

0

AFAIK UISplitViewController 必须是窗口的根视图控制器。不支持将其添加为子视图控制器。

于 2012-12-13T18:16:36.553 回答