iphone - 如何在 iphone 中制作像 pop 这样的动画而不是 push

标签 iphone ios xcode

我正在使用以下代码:

FirstView * fir=[[FirstView alloc]init];
[self.navigationController pushViewController:fir animated:NO];

我想做一个像popview Controller 这样的动画。

提前致谢。

最佳答案

-(void)ButtonAction:(id)sender{
  [self SwipeRight:self.navigationController.view];  // <--calling method
  //[self.navigationController pushViewController:viewcontrollerobject animated:NO];
  // or pop // 
}

    -(void)SwipeRight:(UIView *)view{

        CATransition* transition = [CATransition animation];
        [transition setDuration:0.3];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromRight;
        [transition setFillMode:kCAFillModeBoth];
        [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
        [view.layer addAnimation:transition forKey:kCATransition]; 
    }

    -(void)SwipeLeft:(UIView *)view{
        CATransition* transition = [CATransition animation];
        [transition setDuration:0.3];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromLeft;
        [transition setFillMode:kCAFillModeBoth];
        [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
        [view.layer addAnimation:transition forKey:kCATransition]; 
    }

关于iphone - 如何在 iphone 中制作像 pop 这样的动画而不是 push,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15493570/

相关文章:

ios - 将数据从 UITableViewCell 推送到 ViewController

ios - OpenTok 流视频尺寸是否颠倒?

ios - 兑换交易,删除 tableviewcell

iphone - 无法重现应用审查发现的崩溃。谁能帮助理解这份崩溃报告?

iphone - 静态变量使用不当?

iphone - 子类 UIAlertView 在 iOS 4.2 中未正确绘制

objective-c - 另一个此类对于键 imageView 不符合键值编码

iphone - SQL 的核心数据不起作用

ios - 在iOS 6.0中调整AdBannerView的大小

swift - 添加新的 UIView 后如何删除以前的堆栈?