Skip to content

Commit

Permalink
Check for touchesMoved: instead of touchesBegan:
Browse files Browse the repository at this point in the history
  • Loading branch information
myell0w committed Feb 7, 2011
1 parent 1dd1959 commit ce022bb
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion MTLocateMe.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
#import "MTLocationDefines.h"
#import "MTLocationFunctions.h"
#import "MTLocationManager.h"
#import "MTTouchesBeganGestureRecognizer.h"
#import "MTTouchesMovedGestureRecognizer.h"
16 changes: 8 additions & 8 deletions MTLocateMeBarButtonItem.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
39382D7D12E9B6400012007D /* MTLocateMeButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 39382D7812E9B6400012007D /* MTLocateMeButton.m */; };
39382D7E12E9B6400012007D /* MTLocationDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 39382D7912E9B6400012007D /* MTLocationDefines.h */; };
39382DED12E9B7370012007D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39382DEC12E9B7370012007D /* UIKit.framework */; };
39645C0612FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 39645C0412FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.h */; };
39645C0712FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 39645C0512FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.m */; };
39645C0612FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 39645C0412FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.h */; };
39645C0712FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 39645C0512FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.m */; };
39CFA14312FA267100B859F9 /* MTLocationFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 39CFA14112FA267100B859F9 /* MTLocationFunctions.h */; };
39CFA14412FA267100B859F9 /* MTLocationFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 39CFA14212FA267100B859F9 /* MTLocationFunctions.m */; };
39CFA15E12FA29F000B859F9 /* MTLocateMe.h in Headers */ = {isa = PBXBuildFile; fileRef = 39CFA15D12FA29F000B859F9 /* MTLocateMe.h */; };
Expand All @@ -31,8 +31,8 @@
39382D7812E9B6400012007D /* MTLocateMeButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTLocateMeButton.m; sourceTree = "<group>"; };
39382D7912E9B6400012007D /* MTLocationDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTLocationDefines.h; sourceTree = "<group>"; };
39382DEC12E9B7370012007D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
39645C0412FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTTouchesBeganGestureRecognizer.h; sourceTree = "<group>"; };
39645C0512FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTTouchesBeganGestureRecognizer.m; sourceTree = "<group>"; };
39645C0412FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTTouchesMovedGestureRecognizer.h; sourceTree = "<group>"; };
39645C0512FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTTouchesMovedGestureRecognizer.m; sourceTree = "<group>"; };
397F552812FF6414006BE3B5 /* GoogleBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = GoogleBadge.png; sourceTree = "<group>"; };
397F552912FF6414006BE3B5 /* GoogleBadge@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "GoogleBadge@2x.png"; sourceTree = "<group>"; };
397F552A12FF6414006BE3B5 /* HeadingAngleLarge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = HeadingAngleLarge.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -149,8 +149,8 @@
39382D7912E9B6400012007D /* MTLocationDefines.h */,
39CFA14112FA267100B859F9 /* MTLocationFunctions.h */,
39CFA14212FA267100B859F9 /* MTLocationFunctions.m */,
39645C0412FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.h */,
39645C0512FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.m */,
39645C0412FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.h */,
39645C0512FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.m */,
);
name = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -189,7 +189,7 @@
39CFA14312FA267100B859F9 /* MTLocationFunctions.h in Headers */,
39CFA15E12FA29F000B859F9 /* MTLocateMe.h in Headers */,
39E47D1312FF41D100649F01 /* MTLocationManager.h in Headers */,
39645C0612FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.h in Headers */,
39645C0612FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -247,7 +247,7 @@
39382D7D12E9B6400012007D /* MTLocateMeButton.m in Sources */,
39CFA14412FA267100B859F9 /* MTLocationFunctions.m in Sources */,
39E47D1412FF41D100649F01 /* MTLocationManager.m in Sources */,
39645C0712FF585D008E8F9E /* MTTouchesBeganGestureRecognizer.m in Sources */,
39645C0712FF585D008E8F9E /* MTTouchesMovedGestureRecognizer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
6 changes: 3 additions & 3 deletions MTLocationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import "MTLocationManager.h"
#import "MTLocationDefines.h"
#import "MTLocationFunctions.h"
#import "MTTouchesBeganGestureRecognizer.h"
#import "MTTouchesMovedGestureRecognizer.h"


@implementation MTLocationManager
Expand Down Expand Up @@ -59,11 +59,11 @@ - (void)setMapView:(MKMapView *)mapView {
}

// detect taps on the map-view
MTTouchesBeganGestureRecognizer * tapInterceptor = [[[MTTouchesBeganGestureRecognizer alloc] init] autorelease];
MTTouchesMovedGestureRecognizer * tapInterceptor = [[[MTTouchesMovedGestureRecognizer alloc] init] autorelease];
// safe self for block
__block __typeof__(self) blockSelf = self;

tapInterceptor.touchesBeganCallback = ^(NSSet * touches, UIEvent * event) {
tapInterceptor.touchesMovedCallback = ^(NSSet * touches, UIEvent * event) {
// Reset transform on map
MTClearMapRotation(blockSelf.mapView);

Expand Down
17 changes: 0 additions & 17 deletions MTTouchesBeganGestureRecognizer.h

This file was deleted.

17 changes: 17 additions & 0 deletions MTTouchesMovedGestureRecognizer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// MTTouchesMovedGestureRecognizer.h
// Copyright 2010 Floatopian LLC. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void (^TouchesEventBlock)(NSSet * touches, UIEvent * event);

@interface MTTouchesMovedGestureRecognizer : UIGestureRecognizer {
TouchesEventBlock touchesMovedCallback_;
}

@property(copy) TouchesEventBlock touchesMovedCallback;


@end
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
// Copyright 2010 Floatopian LLC. All rights reserved.
//

#import "MTTouchesBeganGestureRecognizer.h"
#import "MTTouchesMovedGestureRecognizer.h"


@implementation MTTouchesBeganGestureRecognizer
@implementation MTTouchesMovedGestureRecognizer

@synthesize touchesBeganCallback;
@synthesize touchesMovedCallback = touchesMovedCallback_;

- (id)init {
if ((self = [super init])) {
Expand All @@ -20,14 +20,14 @@ - (id)init {
}

- (void)dealloc {
[touchesBeganCallback release];
[touchesMovedCallback_ release], touchesMovedCallback_ = nil;

[super dealloc];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (touchesBeganCallback) {
touchesBeganCallback(touches, event);
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if (self.touchesMovedCallback) {
self.touchesMovedCallback(touches, event);
}
}

Expand Down

0 comments on commit ce022bb

Please sign in to comment.