Skip to content

Instantly share code, notes, and snippets.

@r-plus
Created June 20, 2012 14:10
Show Gist options
  • Select an option

  • Save r-plus/2960087 to your computer and use it in GitHub Desktop.

Select an option

Save r-plus/2960087 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#import <objc/runtime.h>
#import <UIKit/UIKit.h>
#import <substrate.h>
@class UIKeyboardLayoutStar;
static BOOL replaced_UIKeyboardLayoutStar_shouldShowDictationKey(UIKeyboardLayoutStar *self, SEL _cmd) {
// can be able to call original method.
NSLog(@"original return BOOL value = %@", [self PREFIX_shouldShowDictationKey] ? @"YES" : @"NO");
return NO;
}
__attribute__((constructor))
static void OverrideMethodFunction() {
MSHookMessage([UIKeyboardLayoutStar class],
@selector(shouldShowDictationKey),
(IMP)&replaced_UIKeyboardLayoutStar_shouldShowDictationKey,
"PREFIX_");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment