【问题标题】:Blur effect on tableview background does not work对 tableview 背景的模糊效果不起作用
【发布时间】:2019-03-04 11:35:07
【问题描述】:

我正在尝试在底部的 tableview 中复制磨砂玻璃的外观。

我尝试了herehere 描述的方法,但现在似乎都没有。因为这是我得到的结果。

这是我的代码。

tableView.backgroundColor = .clear
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
tableView.backgroundView = blurView

我在模拟器和运行 iOS 12.1 的设备上都进行了测试,但两者都存在问题。

Demo project

我在这里错过了什么?

【问题讨论】:

  • 你的意思是你想在你的 UITableviewCell 中实现同样的模糊效果?
  • 设置 cell.backgroundColor = .clear
  • @NikunjRajyaguru 不,只是表格视图的背景视图。我把它修好了。

标签: ios swift uitableview uivisualeffectview uiblureffect


【解决方案1】:

它不起作用,因为您的 FloatingPanelController 的 surfaceView 不透明。在创建浮动面板时执行此操作:

floatingPanelController.surfaceView.backgroundColor = .clear

【讨论】:

    最近更新 更多