zoukankan      html  css  js  c++  java
  • 更改navigationController push和pop界面切换动画

    For Push:

    MainView *nextView=[[MainView alloc] init];
    [UIView  beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.75];
    [self.navigationController pushViewController:nextView animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];
    [nextView release];

    TwoDView *twoD  =[[TwoDView alloc]init];
        CATransition *animation = [CATransition animation];
        [animation setDuration:0.4];
        [animation setType: kCATransitionPush];
        [animation setSubtype: kCATransitionFromLeft];
        [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
        [self.navigationController pushViewController:twoD animated:NO];
        [self.navigationController.view.layer addAnimation:animation forKey:nil];
        [twoD release];

    For Pop:

    方法一:

    [UIView  beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.75];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelay:0.375];
    [self.navigationController popViewControllerAnimated:NO];
    [UIView commitAnimations];

    方法二:

    可实现左右滑动动画,可设置滑动方向。

    CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
    //transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    [[self navigationController] popViewControllerAnimated:NO];

  • 相关阅读:
    P1135 奇怪的电梯
    pycharm设置快捷键在keymap下拉列表没有eclipse怎么办
    记录selenium简单实现自动点击操作
    selenium 批量下载文件,json,重命名
    python3.6+selenium使用chrome浏览器自动将文件下载到指定路径
    selenium + Java 设置文件默认下载路径
    详解介绍Selenium常用API的使用Java语言(完整版)
    Pycharm安装robot framework运行插件
    Python之robotframework+pycharm测试框架!
    基于Python3 Robot framework环境搭建
  • 原文地址:https://www.cnblogs.com/jiackyan/p/3380471.html
Copyright © 2011-2022 走看看