How do I apply a UILongPressGestureRecognizer to a shape in C4? - ios5

I am working in C4 and want to be able to press down on a shape and drag it at a slow speed upward.
I have been working with the "Getting the UITouch objects for a UIGestureRecognizer" tutorial and other TouchesMoved and TouchesBegan Objective-C tutorials but the gesture is not applying to the shape. The project builds but the shape still does not move when you press and drag it. Is there a particular way C4 applies gestures to shapes?
This is my code:
DragGestureRecognizer.h
#import <UIKit/UIKit.h>
#interface DragGestureRecognizer : UILongPressGestureRecognizer {
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
#end
#protocol DragGestureRecognizerDelegate <UIGestureRecognizerDelegate>
- (void) gestureRecognizer:(UIGestureRecognizer *)gr movedWithTouches:(NSSet*)touches andEvent:(UIEvent *)event;
#end
C4WorkSpace.m:
#import "C4WorkSpace.h"
#import "DragGestureRecognizer.h"
#implementation DragGestureRecognizer
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
if ([self.delegate respondsToSelector:#selector(gestureRecognizer:movedWithTouches:andEvent:)]) {
[(id)self.delegate gestureRecognizer:self movedWithTouches:touches andEvent:event];
}
}
#end
#implementation C4WorkSpace {
C4Shape *circle;
}
- (void)longPress:(UILongPressGestureRecognizer*)gesture {
if ( gesture.state == UIGestureRecognizerStateEnded ) {
NSLog(#"Long Press");
}
}
-(void)setup {
circle = [C4Shape ellipse:CGRectMake(5,412,75,75)];
[self.canvas addShape:circle];
}
#end

C4 has a method that simplifies the process of adding gestures to any visible object (e.g. C4Shape, C4Movie, C4Label...).
NOTE: you will need to create a subclass of C4Shape in which you can create some custom methods.
For instance, the following will add a tap gesture to an C4Shape:
C4Shape *s = [C4Shape rect:CGRectMake(..)];
[s addGesture:TAP name:#"singleTapGesture" action:#"tap"];
The addGesture:name:action: method is listed in the C4Control documentation, and is defined like:
Adds a gesture to an object.
- (void)addGesture:(C4GestureType)type name:(NSString *)gestureName action:(NSString *)methodName
The (C4GestureType)type can be any one of:
TAP
SWIPERIGHT
SWIPELEFT
SWIPEUP
SWIPEDOWN
PAN
LONGPRESS
The following gestures are available, but haven't yet been tested:
PINCH
ROTATION
The (NSString *)gestureName allows you to specify a unique name for the gesture.
The (NSString *)methodName allows you to specify the method that the gesture will trigger.
So... getting back to the example above:
[s addGesture:TAP name:#"singleTapGesture" action:#"tap"];
...will add to the s object a TAP gesture called singleTapGesture which, when triggered, will run a -(void)tap; method (which needs to have already defined in your class).
You can apply the technique I described above, but instead use:
[s addGesture:PAN name:#"panGesture" action:#"move:];
you will also have to define a
-(void)move:(id)sender;
method in your shape's class.

Related

UIControl Not Receiving Touches

I have a UIControl which implements the touches began method like so:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
//More code goes here
This subclass of UIControl is instantiated in a view controller, it is then added as a subview to that view controller. I have a breakpoint at the touches began method of the UIControl, and the method never gets called. I've been doing some reading and it seems that the View Controller has some logic that decides whether to pass on touch events to its subviews. The strange thing is that I have a different subclass of UIControl in the same view controller, and the touch events get passed down to it when the user touches it!
Here is the full code:
.h
#import <UIKit/UIKit.h>
#interface CustomSegment : UIView
#property (nonatomic, strong) UIImageView *bgImageView;
#property (nonatomic, assign) NSInteger segments;
#property (nonatomic, strong) NSArray *touchDownImages;
#property (nonatomic, readonly, assign) NSInteger selectedIndex;
#property (nonatomic, weak) id delegate;
- (id)initWithPoint:(CGPoint)point numberOfSegments:(NSInteger)_segments andTouchDownImages:(NSArray *)_touchDownImages;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
#end
.m
#import "CustomSegment.h"
#implementation CustomSegment
#synthesize bgImageView, segments, touchDownImages, selectedIndex, delegate;
- (id)initWithPoint:(CGPoint)point
numberOfSegments:(NSInteger)_segments
andTouchDownImages:(NSArray *)_touchDownImages
{
self = [super initWithFrame:CGRectMake(point.x, point.y, [[_touchDownImages objectAtIndex:0] size].width, [[touchDownImages objectAtIndex:0] size].height)];
if (self)
{
touchDownImages = _touchDownImages;
segments = _segments;
bgImageView = [[UIImageView alloc] initWithImage:[touchDownImages objectAtIndex:0]];
[self addSubview:bgImageView];
}
return self;
}
- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
{
return YES;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//[super touchesBegan:touches withEvent:event];
UITouch *touch = [touches anyObject];
float widthOfSegment = [self frame].size.width / segments;
float bottomPoint = 0;
float topPoint = widthOfSegment;
for (int i = 0; i < segments; i++)
{
if ([touch locationInView:self].x > bottomPoint && [touch locationInView:self].x < topPoint)
{
[bgImageView setImage:[touchDownImages objectAtIndex:i]];
selectedIndex = i;
return;
}
else
{
bottomPoint = topPoint;
topPoint += topPoint;
}
}
}
#end
tl;dr Set all subviews of the UIControl to setUserInteractionEnabled:NO. UIImageViews have it set to NO by default.
Original Post
One thing I found recently is that it helps if the top-most subview of the UIControl has setUserInteractionEnabled:NO. I arrived at this because I had a UIControl subclass with a UIImageView as it's only subview and it worked fine. UIImageView has userInteractionEnabled set to NO by default.
I also had another UIControl with a UIView as it's top most subview (technically the same UIControl in a different state). I believe UIView defaults to userInteractionEnabled == YES, which precluded the events being handled by the UIControl. Settings the UIView's userInteractionEnabled to NO solved my issue.
I don't know if it's the same issue here, but maybe that will help?
--
Edit: When I say topmost view... probably set all subviews of the UIControl to setUserInteractionEnabled:NO
Check frames of all parent views. The rule is that if sub-view (or its part) of the view is outside the view bounds, it doesn't receive touch events.
Xcode 12 and Latter.
As mention in the accepted answer, make sure all the subviews of the
UIControl view get "User Interaction Enabled" unchecked.
Select your
UIControl view and switch to the "Connection Inspector" and make
sure it has been connected to "Touch Up Inside" event. Sometimes
Xcode uses "Value Changed" event so make sure to change to "Touch
Up Inside" event
It is possible that another view is covering your UIControl, and preventing it from receiving the touch events. Another possibility is that userInteractionEnabled is set to NO somewhere by mistake.
EDIT: I see that you added more code above. Did you verify that your view's frame has a width and height greater than zero? It looks to me like you are calling "size" directly on an object from NSArray (which is 'id'). I don't know how you are doing this without a cast (perhaps the parenthesis didn't come through above?) but if you are somehow pulling it off I wouldn't be surprised if it was an invalid value.
First, why do you call [super touchesBegan:touches withEvent:event];? This call is forwarding the event to the next responder. Usually you do it only when you don't want to handle the event. Are you sure you know what are you doing there?
An idea why it doesn't work - can it be that you have a gesture recognizer which handles the event first?
Anyway, do you really need to override touchesBegan? UIControl is made to track the touch events by itself and call your handlers in response. And the UIControl docs say HOW to subclass it.
Subclassing Notes
You may want to extend a UIControl subclass for either of two reasons:
To observe or modify the dispatch of action messages to targets for particular events
To do this, override sendAction:to:forEvent:, evaluate the passed-in selector, target object, or UIControlEvents bit mask, and proceed as required.
To provide custom tracking behavior (for example, to change the highlight appearance)
To do this, override one or all of the following methods: beginTrackingWithTouch:withEvent:, continueTrackingWithTouch:withEvent:, endTrackingWithTouch:withEvent:.
Possibilities:
You might have forgot to set the delegate for the UIControl.
The other UIControl which receives the touch is obscuring/covering over the UIControl.
Fair enough. Recently re-investigated this (UIControl is very poorly documented) and realised that tracking touches is a replacement for touchesBegan/Ended, not an additional, so sorry about that. I'd reverse the vote but it wouldn't let me :(
You might need to override intrinsicContentSize inside your UIControl subclass.
override var intrinsicContentSize: CGSize {
return CGSize(width: 150, height: 100)
}
I don't quite understand how it fixes it or why, but it works. It doesn't even need to be the exact size as your control.
UIView instances are unable to respond to events so there is no way, up to your current configuration, to trigger your action method ?
Try to change the class of the view to be an instance of the UIControl class !

How to call a method in the viewController from a subclassed UIButton?

I was trying to find a way to recognise a touch&hold on my buttons. I thought that to subclass my buttons was a good idea, but I'm now struggling with the whole idea of subclasses, parentsviews and the viewcontroller. So please forgive, I fear that this is a beginner's question:
How do I call a method (which I've defined in my ViewController) from a subclassed UIButton?
[self someMethod]; doesn't work - as UIButton is not a descendent of my ViewController.
[super someMethod]; doesn't work either - same problem I suppose
[self.superview someMethod]; ... again no luck
[MyViewController someMethod]; doesn't work either -- as it is 'undecleared' -- do I have to import my ViewController? Or do some kind of protocol/class call?
Any help would be very much appreciated.
Here is my subclass:
//
// MoleButton.h
//
#import <Foundation/Foundation.h>
#interface MoleButton : UIButton {
int page;
NSString *colour;
UIViewController *theViewController;
NSTimer *holdTimer;
}
#property (nonatomic, assign) int page;
#property (nonatomic, assign) NSString *colour;
#end
//
// MoleButton.m
#import "MoleButton.h"
#implementation MoleButton
#synthesize page, colour;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
[self.superview touchesBegan:touches withEvent:event];
[holdTimer invalidate];
holdTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:#selector(touchWasHeld) userInfo:nil repeats:NO];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
[self.superview touchesMoved:touches withEvent:event];
[holdTimer invalidate];
holdTimer = nil;
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
[self.superview touchesEnded:touches withEvent:event];
}
- (void)touchWasHeld
{
holdTimer = nil;
// do your "held" behavior here
NSLog(#"TOUCH WAS HELD!!!!");
[self.theViewController doSomething];
}
#end
You can simply add a property in the subclassed UIButton class, which holds the view controller. When initializing it, you need to add the controller, for sure.
Use the very simple delegate concept of Objective-C .
Check my answer in the below post for using delegate in Objective-C .
How do I set up a simple delegate to communicate between two view controllers?

How to setup UIView touch handler without subclassing

How do I capture touch events such as - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event without subclassing a UIView nor using UIViewControllers.
What happens is that I have a simple UIView created programmatically and I need to detect basic tap events.
If you are writing your app for iOS 4, use UIGestureRecognizer. You can then do what you want. Recognize gestures without subclassing.
Otherwise, subclassing is the way to go.
There's just no reason not to. If you subclass and add nothing it's just a UIView called by another name. All you are doing is intercepting those functions that you are interested in. Don't forget you can do [super touchesBegan:touches] inside your subclass' touchesBegan if you don't want to stop responders up the chain from getting those events too.
I don't why you don't want to use the normal method of subclassing a UIView to capture touch events, but if you really need to do something weird or sneaky, you can capture all events (including touch events) before they get sent down the view hierarchy by trapping/handling the sendEvent: method at the UIWindow level.
CustomGestureRecognizer.h
#import <UIKit/UIKit.h>
#interface CustomGestureRecognizer : UIGestureRecognizer
{
}
- (id)initWithTarget:(id)target;
#end
CustomGestureRecognizer.mm
#import "CustomGestureRecognizer.h"
#import <UIKit/UIGestureRecognizerSubclass.h>
#interface CustomGestureRecognizer()
{
}
#property (nonatomic, assign) id target;
#end
#implementation CustomGestureRecognizer
- (id)initWithTarget:(id)target
{
if (self = [super initWithTarget:target action:Nil]) {
self.target = target;
}
return self;
}
- (void)reset
{
[super reset];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
[self.target touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesMoved:touches withEvent:event];
[self.target touchesMoved:touches withEvent:event];
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent: event];
[self.target touchesEnded:touches withEvent:event];
}
#end
Usage:
CustomGestureRecognizer *customGestureRecognizer = [[CustomGestureRecognizer alloc] initWithTarget:self];
[glView addGestureRecognizer:customGestureRecognizer];

Double Tap inside UIScrollView to Another View

I want to preface this question with the fact I am new to the iphone application development and many times believe I may be over my head. I am trying to find an action that will allow me to double tap anywhere within my full screen UIScrollView to return to my main menu (MainMenuViewController).
I currently have the following code running for my ScrollViewController...
ScrollViewController.h
#import <UIKit/UIKit.h>
#interface ScrollViewController : UIViewController <UIScrollViewDelegate>
{
}
#end
ScrollViewController.m
#import "ScrollViewController.h"
UIScrollView *myScrollView;
UIPageControl *myPageControl;
#implementation ScrollViewController
- (void)loadScrollViewWithPage:(UIView *)page
{
int pageCount = [[myScrollView subviews] count];
CGRect bounds = myScrollView.bounds;
bounds.origin.x = bounds.size.width * pageCount;
bounds.origin.y = 0;
page.frame = bounds;
[myScrollView addSubview:page];
}
...etc
Any advice or sample code to implement a double tap within the ScrollView Controller to allow me to return to my MainMenuViewController would be greatly appreciated. Also please include any Interface Builder changes to the view (if necessary). I have been pouring over the forums for days and have not been able to successfully implement this action. Thanks...R.J.
First of all, create a subclass of a UIScrollView:
#import <UIKit/UIKit.h>
#interface MyScrollView : UIScrollView {
}
#end
Implement it:
#import "MyScrollView.h"
#implementation MyScrollView
- (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {
if (!self.dragging) {
[self.nextResponder touchesEnded: touches withEvent:event];
}
[super touchesEnded: touches withEvent: event];
}
- (void)dealloc {
[super dealloc];
}
#end
Then, use this subclass instead of a normal UIScrollView in your main View Controller. This will call the touchesEnded:withEvent: method (alternatively, you can call any method you want). Then, track for double taps (if you need info on how to do that, let me know).

Intercepting/Hijacking iPhone Touch Events for MKMapView

Is there a bug in the 3.0 SDK that disables real-time zooming and intercepting the zoom-in gesture for the MKMapView? I have some real simple code so I can detect tap events, but there are two problems:
zoom-in gesture is always interpreted as a zoom-out
none of the zoom gestures update the Map's view in realtime.
In hitTest, if I return the "map" view, the MKMapView functionality works great, but I don't get the opportunity to intercept the events.
Any ideas?
MyMapView.h:
#interface MyMapView : MKMapView
{
UIView *map;
}
MyMapView.m:
- (id)initWithFrame:(CGRect)frame
{
if (![super initWithFrame:frame])
return nil;
self.multipleTouchEnabled = true;
return self;
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSLog(#"Hit Test");
map = [super hitTest:point withEvent:event];
return self;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(#"%s", __FUNCTION__);
[map touchesCancelled:touches withEvent:event];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent*)event
{
NSLog(#"%s", __FUNCTION__);
[map touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
NSLog(#"%s, %x", __FUNCTION__, mViewTouched);
[map touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
NSLog(#"%s, %x", __FUNCTION__, mViewTouched);
[map touchesEnded:touches withEvent:event];
}
The best way I have found to achieve this is with a Gesture Recognizer. It's unclear if you want to recognize zoom events yourself or just detect when the user is zooming/panning.
I don't need to detect a map pan or zoom--i just care if the user has put a finger down anywhere in the MKMapView. If you need to detect zooming or panning with 100% recall and precision, it might be more complicated than this. What we really need is an open source implementation of MKMapView so we can add this to the delegate, among many other features.
Here's what I do: Implement a gesture recognizer that cannot be prevented and that cannot prevent other gesture recognizers. Add it to the map view and deal with the relevant touch events as you desire.
How to detect any tap inside an MKMapView (sans tricks)
WildcardGestureRecognizer * tapInterceptor = [[WildcardGestureRecognizer alloc] init];
tapInterceptor.touchesBeganCallback = ^(NSSet * touches, UIEvent * event) {
self.lockedOnUserLocation = NO;
};
[mapView addGestureRecognizer:tapInterceptor];
WildcardGestureRecognizer.h
//
// WildcardGestureRecognizer.h
// Copyright 2010 Floatopian LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^TouchesEventBlock)(NSSet * touches, UIEvent * event);
#interface WildcardGestureRecognizer : UIGestureRecognizer {
TouchesEventBlock touchesBeganCallback;
}
#property(copy) TouchesEventBlock touchesBeganCallback;
#end
WildcardGestureRecognizer.m
//
// WildcardGestureRecognizer.m
// Created by Raymond Daly on 10/31/10.
// Copyright 2010 Floatopian LLC. All rights reserved.
//
#import "WildcardGestureRecognizer.h"
#implementation WildcardGestureRecognizer
#synthesize touchesBeganCallback;
-(id) init{
if (self = [super init])
{
self.cancelsTouchesInView = NO;
}
return self;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (touchesBeganCallback)
touchesBeganCallback(touches, event);
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
- (void)reset
{
}
- (void)ignoreTouch:(UITouch *)touch forEvent:(UIEvent *)event
{
}
- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer
{
return NO;
}
- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer
{
return NO;
}
#end
I had the same problem - I wanted to draw map scales on top of Map View. In order to do it I had to intercept the touch events, and then send them back to the Map View. Unfortunately, when the MKMapView isn't the original receiver of the events, some smooth panning and zooming animations are not working any more.
However I have found a solution to this problem - a bit hacky but works:
1. I have put my MapScales UIView on top of MKMapView, and turned off receiving events in it, so that underlying MKMapView received the events by default.
2. I have subclassed UIWindow with MyMainWindow class and in it I have overriden the method:
- (void) sendEvent:(UIEvent*)event {
[super sendEvent:event];
[self send_the_event_also_to_my_MapScales_component_with_use_of_listener_design_pattern];
}
I have made the main window of my application an instasnce of MyMainWindow.
In this way my MapScales component receives and can react to all the touch events, and at the same time it is not spoiling the underlying MKMapView :)
#import <UIKit/UIKit.h>
#import "UIViewTouch.h"
#import <MapKit/MapKit.h>
#interface MapTouchAppDelegate : NSObject <UIApplicationDelegate>
{
UIViewTouch *viewTouch;
MKMapView *mapView;
UIWindow *window;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) UIViewTouch *viewTouch;
#property (nonatomic, retain) MKMapView *mapView;
#end
#import "MapTouchAppDelegate.h"
#implementation MapTouchAppDelegate
#synthesize window;
#synthesize viewTouch;
#synthesize mapView;
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
//We create a view wich will catch Events as they occured and Log them in the Console
viewTouch = [[UIViewTouch alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
//Next we create the MKMapView object, which will be added as a subview of viewTouch
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[viewTouch addSubview:mapView];
//And we display everything!
[window addSubview:viewTouch];
// Override point for customization after application launch
[window makeKeyAndVisible];
}
- (void)dealloc {
[window release];
[super dealloc];
}
#import <UIKit/UIKit.h>
#interface UIViewTouch : UIView
{
UIView *viewTouched;
}
#property (nonatomic, retain) UIView * viewTouched;
- (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
#import "UIViewTouch.h"
#implementation UIViewTouch
#synthesize viewTouched;
//The basic idea here is to intercept the view which is sent back as the firstresponder in hitTest.
//We keep it preciously in the property viewTouched and we return our view as the firstresponder.
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
NSLog(#"Hit Test");
self.multipleTouchEnabled = true;
viewTouched = [super hitTest:point withEvent:event];
return self;
}
//Then, when an event is fired, we log this one and then send it back to the viewTouched we kept, and voilĂ !!! :)
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(#"Touch Began");
[viewTouched touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(#"Touch Moved");
[viewTouched touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(#"Touch Ended");
[viewTouched touchesEnded:touches withEvent:event];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(#"Touch Cancelled");
}
#end
This code will detect touches as well as zooming.
Try
[super touchesEnded:touches withEvent:event];
instead of
[map touchesEnded:touches withEvent:event];
And apply this idea to all of the touch event methods. That way, the touches should travel down the responder chain, and peace will be restored.
To extend up on #chomasek's answer, in order to only process those touches for the map view, I do the following:
Give the map view a tag, like 99
When I get touch, traverse up the view hierarchy of the receiving view, looking for a view with the above tag.
Here is the code:
// this is in the view controller containing the map view
// kICTagForMapView is just a constant
_mapView.tag = kICTagForMapView;
Then in sendEvent:
// this does into the UIWindow subclass
BOOL isMapView = NO;
UIView* superView = touch.view.superview;
while(superView)
{
//Debug(#"superView = %#", superView);
if (superView.tag == kICTagForMapView)
{
isMapView = YES;
break;
}
superView = superView.superview;
}
if (isMapView == NO) return;
// do stuff here
MKMapView does not respond to the touch methods listed above...