控制器的跳转方法

作者: 蜗牛锅 | 来源:发表于2017-05-17 18:46 被阅读23次

在开发过程中,经常会遇到这样跳转,在自定义view、AppDelegate等地方,用push、present不能正常的跳转。我总结了三种方法。如果有其他更好的处理方式,记得告诉我哦!!!

#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
{
      ProjectDetailsViewCtl *vc = [[ProjectDetailsViewCtl alloc]init];
      UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:vc];
      nav.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
     //[self.window.rootViewController presentViewController:nav animated:YES completion:nil];
      [self presentViewController:nav animated:YES completion:nil];
   

}
-(void)navLeftBarAction {
  // 返回 用dismiss
    [self dismissViewControllerAnimated:YES completion:nil];
}

//跳转控制器的方法2
-(void)jumpViewController3
{
      [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:vc animated:YES completion:nil];
}

相关文章

网友评论

    本文标题:控制器的跳转方法

    本文链接:https://www.haomeiwen.com/subject/aezdxxtx.html