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];

 

转载于:https://www.cnblogs.com/cynthia116/p/4494882.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值