这确实是一项简单的任务.所有你需要做的是调用该方法transitionWithView从UIView改变前右previewView输入.
如果您的目标是iOS 8.0或更高版本,您还可以轻松添加模糊效果.
在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()
}
Run Code Online (Sandbox Code Playgroud)
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];
}];
Run Code Online (Sandbox Code Playgroud)