ios - How to intercept touches events on a MKMapView or UIWebView objects? -
I'm not sure what I'm doing but I try to touch on MKMapView
thing. I created the following squares by component:
#import & lt; UIKit / UIKit.h & gt; #import & lt; MapKit / MapKit.h & gt; @ Interface map view: touch: MKMapView {} - (zero) touches: (NSSET *) touches with the event: (UIEvent *) event; @end
and implementation:
#import "MapViewWithTouches.h" @implementation MapViewWithTouches - withEvent touches (zero) touchesBegan: (NSSet *): (UIEvent *) Event {NSLog (@ "Hello"); // [super touching: event: touching event]; } MapViewWithTouches * MapView = [[ MapViewWithTouches alloc] initWithFrame: self.view.frame]; [Insert self.viewSaveview: View mapandex: 0];
Any thoughts that I am doing wrong?
The best way I can get this is with the gesture identifier. Other methods include hackish programming that is incomplete duplicate Turning out to include a lot of Apple's code, especially in the case of MultitT
Here's what I'm doing :. Applying a gesture identifier that can not be stopped and that the other gesture can not be prevented by the recognizers. Add it to the map view, and then use your touchesBegan, touchesMoved, etc. of gestureRecognizer to fancy.
How to detect any tap in a MKMapView (without tricks)
Waildkardjacr solver * Tap Intrseptr = [[Waildkardjastainr cognitive alloc] init]; TapInterceptor.touchesBeganCallback = ^ (NSSet * touch, UIEvent * Event) {self.lockedOnUserLocation = NO; }; [MapView addGestureRecognizer: Tap Interceptor];
wildcard Gescrreknnaijhr. H
// wildcardGestureRecognizer.h Copyright 2012 Flotopian LLC All rights reserved. // #Emportant & lt; Foundation / Foundation. H & gt; Typefiff Zero (^ Touch Dent Block) (NSAT * Touch, UIIvent * Event); @ Interface wildcard gycharacterizer: UIGestureRecognizer {touches the dancer block touchesBeganCallback; } @property (copy) touchs the DentistBlockBigCallBack; @end
WildcardGestureRecognizer.m
// // WildcardGestureRecognizer.m // Raymond // create 31/10/10 by Daily Copyright 2010 Flotopian LLC All Rights Reserved. // # Import "Wildcard Governors Reconnaisser." @ImpilationWildcardJustinerSignity @SantesCare TouchBugCollBack; - (id) init {if (self = [super init]) {self.cancelsTouchesInView = NO; } Healthy return; } - (zero) touches: (nsset *) touches the event: (UIEvent *) event {if (touching eggplant callback) touches the bugan callback (touch, event); } - (void) touches touchesCancelled: (NSSet *) withEvent: (UIEvent *) event {} - (void) touchesEnded: withEvent touches (NSSet *): (UIEvent *) event {} - (void) touchesMoved: ( NSSet * (UITouch *) touch forEvent: (UIEvent *) event {} - (bool) canBePreventedByGestureRecognizer: (UIGestureRecognizer *) preventingGestureRecognizer {- - (void) reset {} (null) ignoreTouch (UIEvent *) event {} :) WithEvent touches does not return; } - (BOOL) canPreventGestureRecognizer: (UIGestureRecognizer *) Restricted GestureRecognizer {Do not return; } @end
Comments
Post a Comment