ios - Bar Button Item in TableViewCell is not registering in didSelectRowAtIndexPath -


func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {     selectedrow = indexpath.row     articleuser = userids2[indexpath.row]     self.performseguewithidentifier("jump", sender: self) }  @ibaction func share(sender: anyobject) {     sharearticleurl = articleurls[selectedrow]         sharetext = "check out \(sharearticleurl)"     let activityvc:uiactivityviewcontroller = uiactivityviewcontroller(activityitems: [sharetext], applicationactivities: nil)     self.presentviewcontroller(activityvc, animated: true, completion: nil)  } 

i have toolbar in each cell of tableview. after update swift 2, when bar button item selected, instead of running didselectrowatindexpath function first instead jumps directly share function. need use indexpath.row in didselect function select proper item in articleurl list. technique above worked fine until update swift 2.

i have tried incorporate let selectedindex = self.tableview.indexpathforcell(sender as! uitableviewcell) in share function haven't been able make work.

why don't set tag on tab bar row number while adding in cellforrowatindexpath: , in share function retrieve passed in sender.


Comments