2009-09-22 13 views

Répondre

0

Montrez-nous du code. Vous devriez pouvoir transmettre tous les événements qui ne vous intéressent pas à la vue parente. Par exemple, une fois que vous avez détecté deux doigts, faites ce que vous voulez, transmettez le même événement à mapview et faites-le zoomer lui-même.

Voici ce que vous appelez une fois que vous avez terminé votre détection d'événements:

[self.nextResponder touchesBegan:touches withEvent:event]; 
0

Selon ceci: link text

Le Mkmapview doit être le récepteur par défaut des événements.

Je changer la classe de ma fenêtre principale MyMainWindow:

MyMainWindow.h

#import <Foundation/Foundation.h> 
@class TouchListener; 

@interface MyMainWindow : UIWindow {  

TouchListener *Touch; 

} 

@end 

MyMainWindow.m

#import "MyMainWindow.h" 

@implementation MyMainWindow 

- (void)sendEvent:(UIEvent*)event { 
[super sendEvent:event]; 
[Touch sendEvent:event]; 
} 
@end 

TouchListener.h

#import <Foundation/Foundation.h> 
@interface TouchListener : UIView { 

} 

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; 
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; 
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; 

@end 

TouchListeners.m

#import "TouchListener.h" 

@implementation TouchListener 

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { 
return self; 
} 

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
NSLog(@"Moved"); 
} 

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSLog(@"Touch Began"); 
} 

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSLog(@"Touch Ended"); 
} 

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 
    NSLog(@"Touch Cancel"); 
} 

@end 

Ai-je raté quelque chose?

Merci pour votre aide