Target action set for a custom button is not called
<p>I have this <code>UIViewController</code> subclass:</p>

<pre><code>class MyViewController: UIViewController {

    let backgroundImageView: UIImageView = {
       let backgroundImage = UIImage(named:"backgroundImg")
       let backgroundImageView = UIImageView(image:backgroundImage)
       backgroundImageView.translatesAutoresizingMaskIntoConstraints = false
       backgroundImageView.contentMode = .ScaleAspectFill
       return backgroundImageView
    }()

    let containerView: UIView = {
       let view = UIView()
       view.translatesAutoresizingMaskIntoConstraints = false
       view.backgroundColor = UIColor.whiteColor()
       return view
    }()

    let customButton: MyCustomButton = {
       let customButton = MyCustomButton()
       customButton.autoSetDimension(.Height, toSize: 50)
       return customButton
    }()

    // More properties and methods

    override func loadView() {
       self.view = UIView()
       self.view.backgroundColor = UIColor.whiteColor()

       self.view.addSubview(backgroundImageView)
       backgroundImageView.addSubview(containerView)

       self.view.addSubview(customButton)
       self.customButton.addTarget(self, action:"navigate", forControlEvents: UIControlEvents.TouchUpInside)

       view.setNeedsUpdateConstraints()
    }

    override func updateViewConstraints() {

       backgroundImageView.autoPinEdgesToSuperviewEdges()

       containerView.autoPinEdge(.Top, toEdge: .Bottom, ofView: (navigationController?.navigationBar)!, withOffset: 0)
       containerView.autoPinEdge(.Left, toEdge: .Left, ofView: backgroundImageView, withOffset: 0)
       containerView.autoPinEdge(.Right, toEdge: .Right, ofView: self.backgroundImageView, withOffset: 0)
       containerView.autoPinEdge(.Bottom, toEdge: .Bottom, ofView: self.backgroundImageView, withOffset: 0) code here

       self.customButton.autoPinEdge(.Left, toEdge: .Left, ofView: self.containerView, withOffset: 10)
       self.customButton.autoPinEdge(.Right, toEdge: .Right, ofView: self.containerView, withOffset: -10)
       self.customButton.autoPinEdge(.Bottom, toEdge: .Bottom, ofView: self.containerView, withOffset: -10)

       super.updateViewConstraints()
   }

   func navigate() {
       let nextVC = NextViewController()
       self.navigationController?.pushViewController(nextVC, animated: true)
   }

}
</code></pre>

<p>I'm using <a href="https://github.com/PureLayout/PureLayout" rel="nofollow">PureLayout</a> framework to arrange subviews. The custom button is correctly displayed, but when I tap on it the <code>navigate</code> method is not called, and I don't understand why... could someone give me a hint?</p>

<p>Thanks</p>

<p><strong>EDIT</strong>: added the view hierarchy in the code snippet. It seems that the custom button is not receiving touch events this way, why?</p>