• 视图切换的几种方法


    代码:

    -(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) {}];
    
    }
  • 相关阅读:
    【Codechef】Chef and Bike(二维多项式插值)
    USACO 完结的一些感想
    USACO 6.5 Checker Challenge
    USACO 6.5 The Clocks
    USACO 6.5 Betsy's Tour (插头dp)
    USACO 6.5 Closed Fences
    USACO 6.4 Electric Fences
    USACO 6.5 All Latin Squares
    USACO 6.4 The Primes
    USACO 6.4 Wisconsin Squares
  • 原文地址:https://www.cnblogs.com/code-style/p/4001839.html
Copyright © 2020-2023  润新知