ios - Tap recognizer only working in first cell -


i have uitableview 1 prototype cell , added long press gesture recognizer has action in code this:

 @ibaction func itinerario(sender: anyobject) {      let = self.tabla     let b: string = "\n"     let c: string = "\n"     let d: string = "*lugar destacado"     let sum = + b + c + d      let alert = uialertcontroller(title: "itinerario de procesión", message: "\(sum)", preferredstyle: uialertcontrollerstyle.alert)     let action1 = uialertaction(title: "atrás", style: uialertactionstyle.cancel, handler: nil)      alert.addaction(action1)       self.presentviewcontroller(alert, animated: true, completion: nil);    } 

but when run project, working first cell of table. how can make work of them?

check console, sure see error ios 9 , up. move gesture recognizer cell table view , say:

@ibaction func itinerario(sender: uitapgesturerecognizer) {     //if need cell or index path      let location = sender.locationinview(self.tableview)     let indexpath = self.tableview.indexpathforrowatpoint(location)     let cell = self.tableview.cellforrowatindexpath(indexpath)     if indexpath != nil     {       let = self.tabla       let b: string = "\n"       let c: string = "\n"       let d: string = "*lugar destacado"       let sum = + b + c + d        let alert = uialertcontroller(title: "itinerario de procesión", message: "\(sum)", preferredstyle: uialertcontrollerstyle.alert)       let action1 = uialertaction(title: "atrás", style: uialertactionstyle.cancel, handler: nil)        alert.addaction(action1)         self.presentviewcontroller(alert, animated: true, completion: nil);     }   } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -