I have a view in a xib file that contains a button and other 2 views and they don't overlap. The view file's owner is a custom class derived from UIViewController. The custom view controller is created programmatically by this code:
let sfvc = SelezioneFascicoloViewController(nibName: "SelezioneFascicoloView", bundle: nil)
viewObject.addSubview(sfvc.view)
sfvc.updateWithAttributes(attrs, inFascicolo: self.fascicolo!)
viewObject is a view contained in a custom UICollectionViewCell.
The button has a handler connected to the touchDown event (but any other event produce the same problem) and it is defined in the custom UIViewController (SelezioneFascicoloViewController) I have flagged showsTouchOnHighlight for the button just to see if it receive the event.
Well, the view shows up correctly, if I tap the button I can see the glow but the handler isn't called. All the views in the hierarchy have the UserInteractionEnabled set to true, and their sizes are correct so the button isn't outside the superview frame.
Also I have a UITapGestureRecognizer in the UICollectionViewController derived class that contains the UICollectionViewCell, and its handler is fired if I tap outside the button, but not when I tap inside the button, and this is as it should be. Can someone give me some advice for this kind of problem?
Edit: added a screenshot