zoukankan      html  css  js  c++  java
  • 视图切换的几种方法

    代码:

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
        //切换方法1
        //动画效果:左右滑动
        //必须有导航器视图才能切换
        [self.navigationController pushViewController:[[ViewController2 alloc]init] animated:YES];
        
        //切换方法2:
        //动画效果:从下滑动到上遮盖住之前的视图,如果有导航栏也被遮盖住了
        ViewController2 *controller = [[ViewController2 alloc]init];
        [self presentViewController:controller animated:YES completion:NULL];
        
        //切换方法3:
        //动画效果:上下的翻动,上下左右的转动,保留导航栏
        //必须都是子视图
        ViewController2 *controller1 = [[ViewController2 alloc]init];
        ViewController2 *controller2 = [[ViewController2 alloc]init];
        [self addChildViewController:controller1];
        [self.view addSubview:controller1.view];
    
        [self addChildViewController:controller2];
        [self.view addSubview:controller2.view];
        
        
        
        [self transitionFromViewController:controller1
                          toViewController:controller2
                                  duration:1
                                   options:UIViewAnimationOptionTransitionCurlDown
                                animations:^{}
                                completion:^(BOOL finished) {}];
    
    }
  • 相关阅读:
    axis2学习笔记
    一个奇怪的数组越界报错
    zk实现分布式锁
    springBoot配置双数据源
    oracle查询
    maven项目打包
    linux修改yum源为阿里云
    kafka入门
    大话设计模式读书笔记(中介者模式)
    大话设计模式读书笔记(职责链模式)
  • 原文地址:https://www.cnblogs.com/code-style/p/4001839.html
Copyright © 2011-2022 走看看