Как перехватить события касаний на объектах MKMapView или UIWebView?
Я не уверен, что делаю не так, но стараюсь уловитьMKMapView
объект. Я вложил его в подкласс, создав следующий класс:
<code>#import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewWithTouches : MKMapView { } - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event; @end </code>
И реализация:
<code>#import "MapViewWithTouches.h" @implementation MapViewWithTouches - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event { NSLog(@"hello"); //[super touchesBegan:touches withEvent:event]; } @end </code>
Но, похоже, когда я использую этот класс, я ничего не вижу на консоли:
<code>MapViewWithTouches *mapView = [[MapViewWithTouches alloc] initWithFrame:self.view.frame]; [self.view insertSubview:mapView atIndex:0]; </code>
Есть идеи, что я делаю не так?