//创建需要切换的跟视图
OneViewController *rootController = [[OneViewController alloc] init];
[UIView transitionFromView:self.view
toView:rootController.view
duration:1.0f
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished) {
//如果是带有SceneDelegate,需要在AppDelegate.h中声明@property(nonatomic,strong)UIWindow * window;,不然会报错
UIWindow * window =[[[UIApplication sharedApplication]delegate]window];
window.rootViewController= rootController;
}];
网友评论