OGeek|极客世界-中国程序员成长平台

标题: ios - 去除模糊效果 - ObjC [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:08
标题: ios - 去除模糊效果 - ObjC

我正在为我的 View 添加模糊效果,如下所示:

UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[blurEffectView setFrame:self.view.bounds];
[self.view addSubview:blurEffectView];

但是如何禁用/移除模糊?



Best Answer-推荐答案


由于 UIVisualEffectViewUIView 的子类,就像您将视觉效果 View 添加到 self.view 作为 subview 一样,只需将其隐藏(UIView 隐藏属性)或从 subview 中删除它。

在您的情况下,我将添加一个引用 View 中 blurEffectView 的实例变量,以便您可以根据需要将其隐藏属性设置为 true 或 false。

关于ios - 去除模糊效果 - ObjC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29858596/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4