我已将我的功能应用于我的 Today Widget 应用程序applyVibrancy
的viewDidLoad
方法。mainViewController
override func viewDidLoad() {
applyVibrancy()
}
func applyVibrancy()
{
let oldView = self.view
var effectView = UIVisualEffectView(effect: UIVibrancyEffect.notificationCenterVibrancyEffect())
effectView.frame = oldView.bounds
effectView.autoresizingMask = oldView.autoresizingMask;
effectView.userInteractionEnabled = true
effectView.contentView.addSubview(oldView)
self.view.tintColor = UIColor.clearColor()
self.view = effectView
}
这成功地将这种视觉效果应用到我的整个小部件中。但我想让我的一些嵌套视图(标签、按钮、图像等)不受这种效果的影响。
我怎样才能做到这一点?