ios - getting error GestureRecognizer with UIImageview in swift -
i using 20 uiimageview have given tag value of each imageview
now want add gesturerecognizer on each image view
for index in 0 ... fields.count - 1{ let gesturerecognizer = uitapgesturerecognizer(target: self, action: "fieldstappedaction") gesturerecognizer.numberoftapsrequired = 1 println(fields[index]) fields[index].addgesturerecognizer(gesturerecognizer) }
now trying tag using fieldstappedaction
func fieldstappedaction (recognizer:uitapgesturerecognizer){ let tappedfield = recognizer.view as! tttimageview tappedfield.setplayer(currectplayer) }
but not working when taped imageview getting app crashed in time of tap.
fieldstapped]: unrecognized selector sent instance 0x7fc95a4abf90 *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-
your selector has arguments needs colon after name. so:
let gesturerecognizer = uitapgesturerecognizer(target: self, action: "fieldstappedaction:")
Comments
Post a Comment