zoukankan      html  css  js  c++  java
  • ios中在uiNavigationcontroller中做转场动画

    1:了解,当创建一个UINavigationcontroller中时,当创建一个子视图控制器压入uiNavigationController中,其中里面的view也别加入UINavigationcontoller.view中去了

    验证代码

    -(void)viewWillDisappear:(BOOL)animated{
        [super viewWillDisappear:animated];
          [self digui:self.navigationController.view];
         NSLog(@"2.1-->%p",self.view.superview);
    }
    
    -(void)digui:(UIView *)view{
        for (UIView *child in view.subviews) {
            NSLog(@"---%p",child);
            [self digui:child];
        }
        
    }

    转场动画第一种方式

    -(void)click{
        
        MyViewController *my=[[MyViewController alloc] init];
        [self.navigationController pushViewController:my animated:NO];
         //因为一个事件循环机制中
        CATransition *tran=[CATransition animation];
        tran.duration=0.75;
        tran.type=@"cameraIrisHollowOpen";
        tran.subtype=kCATransitionFromLeft;
        [self.navigationController.view.layer addAnimation:tran forKey:nil];
    }

    转场动画第二种方式

    -(void)click{
        
        
        [UIView transitionWithView:self.navigationController.view duration:0.5 options:UIViewAnimationOptionTransitionCurlUp animations:^{
            MyViewController *my=[[MyViewController alloc] init];
            [self.navigationController pushViewController:my animated:NO];
        } completion:^(BOOL finished) {
            
        }];
        
     
     
    }

    转场动画第三种方式

    -(void)click{
    
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.5];
        [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view  cache:YES];
        MyViewController *my=[[MyViewController alloc] init];
       [self.navigationController pushViewController:my animated:NO];
        [UIView commitAnimations];
        }
  • 相关阅读:
    Oracle 的日期类型
    简单的同步Socket程序服务端
    MMORPG中的相机跟随算法
    使用了UnityEditor中的API,打包时却不能打包UnityEditor的问题
    C# 中的关键字整理
    Unity3D C#中使用LINQ查询(与 SQL的区别)
    C# 值类型与引用类型的异同
    Unity3D NGUI事件监听的综合管理
    Unity3D 动画状态机简单控制核心代码
    Unity3D判断触摸方向
  • 原文地址:https://www.cnblogs.com/gcb999/p/3189731.html
Copyright © 2011-2022 走看看