Skip to content

Commit

Permalink
zap/swizzle shouldrecordMonkeyTouch - was for UIScrollView
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.gorillalogic.com/svn/fonemonkey4/trunk@41 72bb13d0-f000-403e-beb8-1553beae081e
  • Loading branch information
eschwarz committed Jan 18, 2011
1 parent d9d53a0 commit f3ab5a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions FMUtils.h
Expand Up @@ -44,4 +44,5 @@
+ (BOOL) isKeyboard:(UIView*)view;
+ (NSString*) stringByJsEscapingQuotesAndNewlines:(NSString*) unescapedString;
+ (NSString*) stringByOcEscapingQuotesAndNewlines:(NSString*) unescapedString;
+ (void) setShouldRecordMonkeyTouch:(BOOL)shouldRecord forView:(UIView*)view;
@end
14 changes: 14 additions & 0 deletions FMUtils.m
Expand Up @@ -304,5 +304,19 @@ + (NSString*) stringByOcEscapingQuotesAndNewlines:(NSString*)unescapedString {
return escapedString;
}

- (BOOL) recordMonkeyTouchesYes:(UITouch*)touch {
return YES;
}
- (BOOL) recordMonkeyTouchesNo:(UITouch*)touch {
return NO;
}
+ (void) setShouldRecordMonkeyTouch:(BOOL)shouldRecord forView:(UIView*)view {
Class viewClass = [view class];
Method currentMethod = class_getInstanceMethod(viewClass, @selector(shouldRecordMonkeyTouch:));
Method replaceMethod = class_getInstanceMethod([FMUtils class],
shouldRecord ? @selector(recordMonkeyTouchesYes:)
: @selector(recordMonkeyTouchesNo:));
method_setImplementation(currentMethod,method_getImplementation(replaceMethod));
}

@end

0 comments on commit f3ab5a7

Please sign in to comment.