首页 > 其他 > 详细

模拟Push和Pop动作

时间:2014-06-27 14:41:35      阅读:346      评论:0      收藏:0      [点我收藏+]

 

//利用CATransition来作模拟

 

//模拟Push
- (void)pushView:(UIView *)pushView inView:(UIView *)inView
{
    CATransition *animation = [CATransition animation];
    animation.duration = 0.2f;
    animation.timingFunction = [CAMediaTimingFunction
                                functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    animation.fillMode = kCAFillModeForwards;
    animation.type = kCATransitionPush;
    animation.subtype = kCATransitionFromRight;
    [inView.layer addAnimation:animation forKey:nil];
    [inView addSubview:pushView];
}

//模拟pop
- (void)navPopView:(UIView *)popView
{
    CATransition *animation = [CATransition animation];
    animation.duration = 0.2f;
    animation.timingFunction = [CAMediaTimingFunction
                                functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    animation.fillMode = kCAFillModeForwards;
    animation.type = kCATransitionPush;
    animation.subtype = kCATransitionFromLeft;
    [self.view.layer addAnimation:animation forKey:nil];
    [popView removeFromSuperview];
}

 

模拟Push和Pop动作,布布扣,bubuko.com

模拟Push和Pop动作

原文:http://www.cnblogs.com/mohe/p/3810316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!