IOS开发之页面切换

从一个ViewController切换到另一个ViewController有下面几种方法:

(1)addsubview方法切换视图
         self.view addSubview:(加载的新页面);
     相应的 [self.view removeFromSuperview];移除添加的view
 
(2)self.view insertSubview:(加载的新页面) atIndex:n;
对n的解释:页面都是层次叠加的,n表示加载到那一层上面
 
(3)presentModalViewController方法

        photoNacController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

     photoNacController.modalPresentationStyle = UIModalPresentationFullScreen;

    self presentModalViewController:(加载的新页面) animated:
    modalTransitionStyle用于设置页面切换的动画
     modalPresentationStyle用于设置视图显示的方式
         两种方法试试就知道用途了!
 
(4) pushViewController 导航
       [self.navigationController pushViewController:(加载的新页面) animated:YES];
      对应的

        [self.navigationController popViewControllerAnimated:YES];

 

posted on 2015-05-11 16:21  cynthia116  阅读(371)  评论(0编辑  收藏  举报

导航