swift - How to detect a long pressure on an AnnotationView on iOS? -


i reproduce effect of ios dashboard on map annotation wobbling them once long press 1 of them. yet stuck @ detecting when user has long pressed one. here code:

override init(annotation:mkannotation, reuseidentifier identifier:string) {     bookingimageview = uiimageview(image: self.bookingimage)     ...     let lpgr = uilongpressgesturerecognizer(target: self, action: selector("handlelongpressure:"))     lpgr.minimumpressduration = 2.0;  //user must press 2 seconds     bookingimageview.addgesturerecognizer(lpgr) }  func handlelongpressure(notification: nsnotification){     wobble() } 

it not work, either if associate gesture annotation or subview(bookingimageview).

you need set user interaction enabled

bookingimageview.userinteractionenabled = true 

Comments

Popular posts from this blog

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -