Adding a UIVisualEffectView to button
<p>i have a transparent delete <code>UIButton</code> added to a story board scene, which has a picture as a background, and i have added some auto layout constraints to it.</p>

<p>i want the button background to be a <code>UIVisualEffectView</code> so i was thinking of programatically adding the view to where the button is, then removing the button and adding it back so it's on top of the <code>UIVisualEffectView</code>.
<strong>Question 1) is this a good idea - or should i find the position in the view hierarchy and place it one level before the button?</strong></p>

<p>here's what i have thus far. for the <code>UIButton</code>:</p>

<pre><code>@IBOutlet weak var delete: UIButton! {
    didSet {
        let borderAlpha = CGFloat(0.7)
        let cornerRadius = CGFloat(5.0)
        delete.setTitle("Delete", forState: UIControlState.Normal)
        delete.setTitleColor(UIColor.redColor(), forState: UIControlState.Normal)
        delete.backgroundColor = UIColor.clearColor()
        delete.layer.borderWidth = 1.0
        delete.layer.borderColor = UIColor(white: 1.0, alpha: borderAlpha).CGColor
        delete.layer.cornerRadius = cornerRadius
    }
}
</code></pre>

<p>and for the <code>UIVisualEffectView</code>:</p>

<pre><code>override func viewDidLoad() {
    super.viewDidLoad()

    let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light))
    visualEffectView.frame = delete.frame
    visualEffectView.bounds = delete.bounds
    view.addSubview(visualEffectView)
}
</code></pre>

<p>this produces a blurred view, the same size as the button, but it's not on top of the button. <strong>Question 2) do i need to somehow pass the auto layout constraints, too?</strong></p>

<p>thanks in advance for any help.</p>