ios - In Swift is there anyway to know which object was swiped? -
i want pass sender redbox
function leftswipefunc
. don't know how pass parameter that's not uiswipegesturerecognizer
. please me if know answer.
let swipeleft = uiswipegesturerecognizer(target: self, action: selector("leftswipefunc:")) swipeleft.direction = uiswipegesturerecognizerdirection.left redbox.addgesturerecognizer(swipeleft) func leftswipefunc(gesture:uiswipegesturerecognizer){ }
gesture recognizers have property called view
uiview
attached to. so, can use inside of leftswipefunc
view:
func leftswipefunc(gesture: uiswipegesturerecognizer) { let swipedview = gesture.view // assuming redbox property of view controller if swipedview == redbox { println("the redbox swiped") } else { println("some other view swiped") } }
Comments
Post a Comment