UIButton is not highlighting when pressed
<p>My <code>UIButton</code> instance is not highlighting when pressed. I'm pretty sure my code is correct. This only happens in this specific class that I am using. I'm guessing because the function has been overridden by a protocol that I am conforming to.</p>

<p>I want to make the <code>UIButton</code> highlight the default way, but I have to do it manually. How can I force highlight the button when pressed, and what are the default settings for it (in terms of colour), so that it is consistent with all the other buttons?</p>

<p>Here is my current code:</p>

<pre><code>    let backButton = UIButton()
    backButton.setTitle("back", for: .normal)
    backButton.setTitleColor(UIColor.black, for: .normal)
    backButton.adjustsImageWhenHighlighted = true
    RevealBar.addSubview(backButton)
    backButton.snp.makeConstraints { (make) -&gt; Void in
        make.center.equalTo(RevealBar)
        make.width.equalTo(RevealBar)
        make.height.equalTo(RevealBar)
    }

    backButton.addTarget(self, action: #selector(self.goBack), for: .touchUpInside)
</code></pre>