此代码在以编程方式调用的函数内部调用。它插入的 UITableView 已放入 Storyboard中的 UIViewController 中。 UIViewController
嵌入在navigationController 中。
let containerView = UIView()
containerView.frame.size.width = self.view.frame.width / 2
containerView.frame.size.height = self.view.frame.width / 2
let blurEffect = UIBlurEffect(style: .Dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = containerView.bounds
containerView.center = self.view.center
containerView.addSubview(blurEffectView)
self.view.insertSubview(containerView, aboveSubview: matchTableView)
indicator?.startAnimation()
我只是想在表格 View 上添加一个事件指示器。实际事件指示器显示得很好,但我需要在其后面放置背景,以便可以正确看到它。一旦将任何类型的 subview 添加到 UIViewController 中,表格就会消失。
最佳答案
你尝试过吗:
let containerView = UIView()
...
containerView.opaque = false
containerView.backgroundColor = UIColor.clearColor()
关于ios - 将 subview 添加到 UIViewController 使 UITablview subview 消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34388455/