ios - 如何从 super View 中删除模糊 subview

标签 ios swift blur

我需要在显示警报时模糊屏幕,因此我在谷歌上搜索了该功能,该功能使屏幕模糊

看起来像

var effectView: UIVisualEffectView!

 func addBlur() {

    var effect = UIBlurEffect(style: UIBlurEffectStyle.Light)
    effectView = UIVisualEffectView(effect: effect)
    effectView.frame = CGRectMake(0, 0, self.view.bounds.width, self.view.bounds.height)
    view.addSubview(effectView)

}

我想在用户解除警报后消除模糊,我想出了这样的功能

func removeBlur() {
    effectView.view.removeFromSuperview()
}

但它不起作用,说 UIVisualEffectView 没有名为“view”的成员

如何解决?

最佳答案

func removeBlur() {
    effectView.removeFromSuperview()
}

关于ios - 如何从 super View 中删除模糊 subview ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31942198/

相关文章:

ios - UITableViewCell 上的 UIPanGestureRecognizer 覆盖了 UITableView 的 ScrollView 手势识别器

ios - 是否可以在 IOS 中运行谷歌地图导航而不是苹果 map

ios - JSONModel:填充泛型类型的 NSArray

swift - CorePlot 与 swift : there is no yAxis. MajorIntervalLength

jquery - 如何使用纯 jQuery 延迟移除字段焦点?

android - 如何模糊 android 中的 View 或布局?

ios - 是否可以使用推送通知向应用程序用户发送新年祝福

ios - 如何更改属性字符串中字符的对齐方式

swift - 可选的 UInt8?给出 2 字节内存大小

java - 如何使用 Swing 和 JLayer<> 在 Java 中制作模糊的 JFrame/JDialog?