#pragma mark ---- 跳转控制器的方法 ---
-(void)jumpViewController
{
MoreViewController *more = [[MoreViewController alloc]init];
UIApplication *app =[UIApplication sharedApplication];
AppDelegate *app2 = app.delegate;
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:more];
app2.window.rootViewController = nav;
app2.window.rootViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
}
//跳转控制器的方法2
-(void)jumpViewController2
{
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc];
nav.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
}
//跳转控制器的方法2
-(void)jumpViewController3
{
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
}
-(void)jumpViewController
{
MoreViewController *more = [[MoreViewController alloc]init];
UIApplication *app =[UIApplication sharedApplication];
AppDelegate *app2 = app.delegate;
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:more];
app2.window.rootViewController = nav;
app2.window.rootViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
}
//跳转控制器的方法2
-(void)jumpViewController2
{
UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc];
nav.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
}
//跳转控制器的方法2
-(void)jumpViewController3
{
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
}
本文介绍了三种在iOS应用中实现视图控制器跳转的方法:通过修改UIApplication代理的window.rootViewController来切换根视图控制器;使用modalTransitionStyle进行覆盖垂直转换;以及通过当前窗口的rootViewController来展示新的视图控制器。
938

被折叠的 条评论
为什么被折叠?



