我有一个小型应用程序,它包含一个带有 UIImageView 的 View Controller 。当用户点击屏幕时,会显示一个带有自定义转换的 tableview Controller (模型)。过渡将 UIBlurEffectview 添加到呈现的 tableview。期望的效果是在模糊图像上显示 UITableView。
当 tableview 出现时,它会在一瞬间显示模糊 View 。但是,一旦完成 block 退出(在 presentViewController:animated:completion 上), View 就会完全变黑。
完成 block 退出前的例子:
完成 block 退出后:
这是转场代码:
UIViewController *sourceController = self.sourceViewController;
UIViewController *destinationController = self.destinationViewController;
UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
blurView.frame = destinationController.view.frame;
[destinationController.view setOpaque:NO];
[destinationController.view setBackgroundColor:[UIColor clearColor]];
[destinationController.view insertSubview:blurView atIndex:0];
[destinationController setModalPresentationStyle:UIModalPresentationFullScreen];
[sourceController presentViewController:destinationController animated:NO completion:^{
NSLog(@"Completed");
}];
我有点不知道该去哪里。我知道在调用完成 block 之前的最后一次调用是呈现 Controller 上的 viewDidAppear,这并没有改变任何东西。非常感谢任何帮助。
最佳答案
找到解决方案。如果您使用的是 Modal segue,则需要将 Presentation 从默认设置为全屏。
关于ios - UIStoryboardSegue & UIVisualEffectView - 完成 block 退出后模糊效果丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26551012/