self.view添加UIView时添加动画

    CATransition *animation = [CATransition animation];
    animation.delegate = self;
    animation.duration = 0.5f;
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    
    if ([subView isKindOfClass:[AreaNumPickerView class]]) {
        animation.subtype = kCATransitionFromBottom;
    }else{
        animation.type    = kCATransitionPush;     //平移
        animation.subtype = kCATransitionFromRight;//从右到左
    }
    
    [superView addSubview:subView];
    [[superView layer] addAnimation:animation forKey:@"animation"];

 

posted @ 2014-08-04 10:59  2014_4_30  阅读(249)  评论(0编辑  收藏  举报