当前位置:首页 > 操作系统 > Ios

iOS界面之间的跳转方式

            iOS界面之间的跳转方式基本有3种。

            1
            、改变window的根视图

  [self.window setRootViewController:VC];


            2
            、模态弹出

     [self  presentViewController:nextVC  animated:YES completion:nil];
            //
            从当前界面到nextVC
     [self dismissViewControllerAnimated:YES completion:nil];//从nextVC界面回去3 用 UINavigationController push 进来和pop回去

     [self.navigationController pushViewController:nextVC animated:YES];//从当前界面到nextVC这个界面
     [self.navigationController popViewControllerAnimated:YES];//nextVC这个界面回到上一界面
     [self.navigationController popToRootViewControllerAnimated:YES];//回到根视图界面

     //self.navigationController.viewControllers 是一个数组里面存放所有之前push过来的界面,如果想要跳回到指定界面 只需要根据索引值取出响应的界面pop回去

     MainViewController *MainVC =self.navigationController.viewControllers[1];
     [self.navigationController popToViewController:MainVC animated:YES];

 

原文:http://www.cnblogs.com/Free-Thinker/p/7729321.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!