开发者社区> 问答> 正文

iphone中使用弹出动画

使用了下面的代码:

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

能否实现一个弹出动画?

展开
收起
爵霸 2016-03-24 10:21:23 1685 0
1 条回答
写回答
取消 提交回答
  • -(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]; 
        }
    2019-07-17 19:12:05
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载