1
我有一個工作的ViewController與工作UIBlurEffect。這裏是我的代碼:如何將UIVibrancyEffect添加到現有的UILabel(IBOutlet)?
@IBOutlet weak var nameLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
let blurEffect = UIBlurEffect(style: .Light)
let blurView = UIVisualEffectView(effect: blurEffect)
blurView.frame = self.view.frame
blurView.setTranslatesAutoresizingMaskIntoConstraints(false)
self.view.insertSubview(blurView, atIndex: 0)
}
現在我想添加一個UIVibranyEffect到nameLabel。 如何以編程方式將UIVibrancyEffect添加到現有的UILabel?