gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 12:35:12 27 4
gpt4 key购买 nike

我有一个小型应用程序,它包含一个带有 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com