ios - 在 TableView Controller 中的 TableView 上添加模糊 View

标签 ios swift xcode uitableview

单击按钮后,当我的叠加 subview 添加到 super View 时,我希望能够使用模糊和鲜艳的视觉效果来遮盖背景 (UITableViewController)。通常,我会将视觉效果拖放到 Main.storyboard 中,但是,我无法将效果拖到 TableView 中。任何帮助将不胜感激

提前致谢!

最佳答案

您可以通过以下方式在主视图上添加模糊 View

@IBAction func addBlur(_ sender: Any) {
    let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light)
    let blurEffectView = UIVisualEffectView(effect: blurEffect)
    blurEffectView.frame = view.bounds
    blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
    view.addSubview(blurEffectView)
}

还有更多内容

let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light)

您可以添加以下效果

extraLight
light
dark
regular      //10.0 or higher
prominent    //10.0 or higher

您还可以使用更多 this开源库提供更大的灵 active

关于ios - 在 TableView Controller 中的 TableView 上添加模糊 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45502743/

相关文章:

Xcode 4 : Source Control options grayed out (Git local repository)

ios - 不兼容的指针类型将 UIFont 发送到 NSDictonary 类型的参数?

c# - 如何在 iOS 应用程序的 Xamarin 表单中更改全局色调颜色?

ios - 使用几种不同类型的单元格滚动 UITableView 不够平滑

ios - 如何根据iPhone 8、X或iPad的屏幕尺寸更改代码

ios - Swift NSURL 在有效网址上给出错误

ios - UIPickerView - 第一行选择不调用 didSelectRow(在 Swift 中)

ios - 在 SKScene 中转至 UIViewController

ios - 安装 Cocoa Pod 依赖项而没有它的子依赖项之一

ios - UITextField 不显示键盘语言选择