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

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -