Reputation: 8068
This question has been asked a few times on SO, but the solution always seems to be adding :
to the end of the action
String, or adding a sender parameter, like UIButton
or AnyObject
, but this does not apply to me.
Here is my code: (inside the cellForRowAtIndexPath
function)
let mapsbut = cell.viewWithTag(912) as! UIButton
mapsbut.addTarget(self, action: "mapsHit:", forControlEvents: UIControlEvents.TouchUpInside)
func mapsHit(sender: UIButton!){
passBuild = buildings[indexPath.row]
performSegueWithIdentifier("mapSegue2", sender: self)
}
return cell
Any ideas what's going wrong?
Upvotes: 2
Views: 292
Reputation: 89559
Try moving your mapsHit
function out of the cellForRowAtIndexPath:
function to make it a global (in the view controller context) instead of a nested function within your cellForRowAtIndexPath
method.
Upvotes: 1