title: Swift: UIButton touch event not getting called inside the custom view
body: <p>I have created a custom view from xib(freeform) in which there are two button (Login and cancel) and i have present it at a view according to some condition. Custom view get present on another view nicely but the button(Login an cancel) not getting any touch event.</p>
  
  <p>Code of custom class and init method:</p>
  
  <pre><code>import UIKit
  class customAlertView: UIView {
  
    @IBOutlet weak var messageLabel: UILabel!
    @IBOutlet weak var loginButton : UIButton!
    @IBOutlet weak var cancelButton: UIButton!
  
    var view : UIView!
  
  
    override init(frame: CGRect) {
      super.init(frame: frame)
  
      view  = setUpFromXib()
      view.frame  = frame
    }
  
    required init?(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
    }
  
    func setUpFromXib() -&gt; UIView {
  
      let bundle  = NSBundle(forClass: self.dynamicType)
      let nib     = UINib(nibName: "customAlertView", bundle: bundle)
      let view    = nib.instantiateWithOwner(self, options: nil)[0] as! UIView
      view.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
      addSubview(view)
      translatesAutoresizingMaskIntoConstraints = true
      return view
  
    }
  
    @IBAction func loginButtonAction(sender: AnyObject) {
    }
  
    @IBAction func cancelButtonAction(sender: AnyObject) {
    }
  }
  </code></pre>
  
  <p>This is the block of code from where i have add the custom view as a subview.</p>
  
  <pre><code>func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  
          if Reachability.isConnectedToNetwork() {
  
              categoryObj = categoryArray .objectAtIndex(indexPath.row) as! TECategoryDetails
              if categoryObj.categoryType == "premium" {
  
                let screen = UIScreen.mainScreen().bounds
  
               customView  = customAlertView.init(frame: CGRect(origin: CGPoint(x: 0,y: 80), size: CGSize(width: screen.width, height: screen.height/3)))
                self.view .addSubview(customView)
  
                  }
  
              else{
                watchAllFlag = false
                self.performSegueWithIdentifier("Episode", sender: self)
              }
          }
          else {
              self.showAlertPopUp() 
  
          }
      }
  </code></pre>