我提出了一个包含UIVisualEffectView的UIViewController,如下所示:
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:@"segueBlur" sender:nil];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:@"segueBlur"]) {
((UIViewController *)segue.destinationViewController).providesPresentationContextTransitionStyle = YES;
((UIViewController *)segue.destinationViewController).definesPresentationContext = YES;
((UIViewController *)segue.destinationViewController).modalPresentationStyle = UIModalPresentationOverFullScreen;
}
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我正在使用UIModalPresentationStyleOverFullScreen,以便当出现模糊的视图控制器时,模糊将"应用"到呈现它的视图控制器的内容; segue具有Cross Dissolve过渡风格.
效果看起来像预期的那样.但是,在iOS 9中,演示比iOS 10更流畅.在iOS 10中,当视图控制器出现时,它看起来像是两步动画,而在iOS 9中,模糊立即应用.
一张图片胜过千言万语所以我上传了一段显示这种奇怪行为的视频:
UIVisualEffectView iOS 9 vs iOS 10
我的问题是:如何在iOS 10中呈现iOS 10中的视图控制器?