我有一个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;
}];
}
答案 0 :(得分:0)
AFAIK UISplitViewController必须是窗口的根视图控制器。不支持将其添加为子视图控制器。