下拉弹窗 pop push动画实现

- (void)popTitleView:(UIButton *)btn

{

    if (popView.superview ==self.view) {

        CATransition *animation =[CATransition animation];

        animation.delegate=self;

        animation.duration=0.3;

        animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

        animation.type=kCATransitionPush;

        animation.subtype=kCATransitionFromTop;

        [popView setAlpha:0.0f];

        [popView.layer addAnimation:animation forKey:@"TSLocateView"];

        [popView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.3];

    }else{

        CATransition *animation =[CATransition animation];

        animation.delegate=self;

        animation.duration=0.3;

        animation.timingFunction=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

        animation.type=kCATransitionPush;

        animation.subtype=kCATransitionFromBottom;

        [popView setAlpha:1.0f];

        [popView.layer addAnimation:animation forKey:@"pushIn"];

        [self.view addSubview:popView];

    }

}

posted @ 2015-04-03 11:43  baohong的博客园  阅读(258)  评论(0)    收藏  举报