码迷,mamicode.com
首页 > 其他好文 > 详细

模拟Push和Pop动作

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

标签:style   class   blog   code   color   cti   

 

//利用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动作

标签:style   class   blog   code   color   cti   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!