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"];
原文地址:https://www.cnblogs.com/hw140430/p/3889651.html