#import "UITextField+Delegate.h"
#import <objc/runtime.h>
NSString * const HLTextFieldDidDelegateBackwardNotification = @"textfeild.did.delegate.notification";
@implementation UITextField (Delegate)
+ (void)load {
//交换2个方法
Method method1 = class_getInstanceMethod([self class], NSSelectorFromString(@"deleteBackward"));
Method method2 = class_getInstanceMethod([self class], @selector(HL_deleteBackward));
method_exchangeImplementations(method1, method2);
}
- (void)HL_deleteBackward {
[self HL_deleteBackward];
[[NSNotificationCenter defaultCenter] postNotificationName:HLTextFieldDidDelegateBackwardNotification object:self];
}