This is a really easy task. All you have to do is call the transitionWithView
method from the UIView
just before changing the previewView
input.
If you're targeting iOS 8.0 or later, you can also easily add a blur effect.
In Swift:
let blurView = UIVisualEffectView(frame: previewView.bounds) blurView.effect = UIBlurEffect(style: .Light) previewView.addSubview(blurView) UIView.transitionWithView(previewView, duration: 0.4, options: .TransitionFlipFromLeft, animations: nil) { (finished) -> Void in blurView.removeFromSuperview() }
Objective-C:
UIVisualEffectView *blurView = [[UIVisualEffectView alloc] initWithFrame:_previewView.bounds]; blurView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; [_previewView addSubview:blurView]; [UIView transitionWithView:_previewView duration:0.4 options:UIViewAnimationOptionTransitionFlipFromLeft animations:nil completion:^(BOOL finished) { [blurView removeFromSuperview]; }];
source share