ios - UIStoryboardSegue & UIVisualEffectView - 完成 block 退出后模糊效果丢失

标签 ios cocoa-touch uiview uiviewcontroller uikit

我有一个小型应用程序,它包含一个带有 UIImageView 的 View Controller 。当用户点击屏幕时,会显示一个带有自定义转换的 tableview Controller (模型)。过渡将 UIBlurEffectview 添加到呈现的 tableview。期望的效果是在模糊图像上显示 UITableView。

当 tableview 出现时,它会在一瞬间显示模糊 View 。但是,一旦完成 block 退出(在 presentViewController:animated:completion 上), View 就会完全变黑。

完成 block 退出前的例子: enter image description here

完成 block 退出后: enter image description here

这是转场代码:

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/

相关文章:

ios - UIView一开始就往下跳

ios - 通过字符串设置 Objective-C 属性

ios - 试图创建一个彩色圆圈 UIImage,但它总是以方形结束。为什么?

ios - xcode/swift 中类名的错误?

ios - 单击 UIView 时从 UIView 内部的标签获取文本

ios - 在移动浏览器 ios 中单击链接打开应用程序

ios - 如何在 iOS 中使用贝塞尔曲线路径创建新月?

iphone - 如何在编辑模式下选择行?

ios - Swift:UIButton 不可点击的重叠 View

ios - NSURLRequest Null(没有编码问题)