我正在尝试将视图从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的当前方向模式下显示整个分割视图。
我希望我足够清楚。
感谢您的帮助。
答案 0 :(得分:1)
我找到了一种让它从该线程起作用的方法:
RootViewController animation transition, initial orientation is wrong
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];