Search code examples
swiftibactionuitapgesturerecognizer

UITapGestureRecognizer won't connect directly to assistant editor?


I am trying to create a Button that utilizes a UITapGestureRecignizer to perform a segue. For some reason, when i try to control-drag from the navigation panel to the assistant editor, it won't connect. I am using the following code:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "showChemistryDetailSegue" {

            let chemistryButton = sender!.view as! UIButton
            if let index = chemistryButtonArray.indexOf(chemistryButton){
                let chemistryDetailController = segue.destinationViewController as! ChemistryDetailViewController
                chemistryDetailController.chemistry = Chemistry(index: index)
            }

        }
    }
    @IBAction func showPlaylistDetail(sender: AnyObject) {
        performSegueWithIdentifier("showChemistryDetailSegue", sender: sender)
    }

}

I am trying to connect the UITapGestures(there are 2) to the following block of code:

@IBAction func showPlaylistDetail(sender: AnyObject) {
        performSegueWithIdentifier("showChemistryDetailSegue", sender: sender)
    }

I am wondering if there is a way to fix this.

Any suggestions or input is greatly appreciated.

Thanks in advance.


Solution

  • I recently figured out the answer. It was actually a really easy. I just connected the ViewController to the class I was trying to connect the UITapGestureReconizer to. Can't believe I didn't spot this simple error!