zoukankan      html  css  js  c++  java
  • 动画切换效果之push、pop、present、dismiss

    有时候页面跳转或视图切换的时候,需要做成特定的效果,常见的push、pop、present、dismiss效果如下,注意要添加代理

    push默认动画效果

        CATransition *transition = [CATransition animation];
        transition.duration = 0.3f;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromRight;
        transition.delegate = self;
        [self.contentView.layer addAnimation:transition forKey:nil];
        [self.contentView addSubview:self.productDetailController.view];
    
    

    pop默认动画效果

        CATransition *transition = [CATransition animation];
        transition.duration = 0.3f;
        transition.timingFunction = [CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromLeft;
        transition.delegate = self;
        [self.view.superview.layer addAnimation:transition forKey:nil];
        [self.view removeFromSuperview];
    

    present默认动画效果

        CATransition *transition = [CATransition animation];
        transition.duration = 0.4f;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionMoveIn;
        transition.subtype = kCATransitionFromTop;
        transition.delegate = self;
        [[self currentNavigationController].view.layer addAnimation:transition forKey:nil];
        [[self currentNavigationController] pushViewController:playVC animated:NO];
    
    

    dismiss默认动画效果

        CATransition *transition = [CATransition animation];
        transition.duration = 0.3f;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionReveal;
        transition.subtype = kCATransitionFromBottom;
        transition.delegate = self;
        [self.navigationController.view.layer addAnimation:transition forKey:nil];
        [self.navigationController popViewControllerAnimated:NO];
    
  • 相关阅读:
    Linux笔记 三剑客之sed
    Linux笔记 用户组管理
    Linux实验之软件管理
    Linux实验之系统安装
    gd_t , bd_t 结构分析
    编辑linux内核与bosybox 时,make menuconfig 出现错误
    4412裸板开发 (1点灯)
    tiny4412SDK 1312B 启动ubuntuDsektop
    tiny4412 启动方式
    linux minitools+minicom 安装及使用
  • 原文地址:https://www.cnblogs.com/dongliu/p/6824012.html
Copyright © 2011-2022 走看看