1

我目前正在尝试将视图从 UIViewController 切换到 SplitViewController。我目前正在我的 UIViewController 中执行此操作:

AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

[UIView transitionWithView:delegate.window duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
    delegate.window.rootViewController = delegate.splitViewController;
} completion:nil];

[self.view removeFromSuperview];

这是切换视图的正确方法吗?如果是,我仍然有一个问题需要用这种方法解决。它首先在纵向模式下快速显示 MasterView,然后在 iPad 的当前方向模式下显示整个拆分视图。

我希望我足够清楚。

谢谢你的帮助。

4

1 回答 1

1

我找到了一种让它从那个线程工作的方法:

RootViewController 动画过渡,初始方向错误

AppDelegate *delegate =(AppDelegate *)[[UIApplication sharedApplication] delegate];
[UIView transitionWithView:self.window duration:0.5 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
    BOOL oldState = [UIView areAnimationsEnabled];
    [UIView setAnimationsEnabled:NO];
    delegate.window.rootViewController = self.splitViewController;
    [UIView setAnimationsEnabled:oldState];
 } 
 completion:nil];
于 2012-02-14T19:05:33.017 回答