Skip to content

Commit

Permalink
fix issues/40
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakey committed Mar 30, 2018
1 parent 3904c68 commit 4253e25
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions JKCategories/UIKit/UITextView/UITextView+JKInputLimit.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,18 @@ - (void)jk_textViewTextDidChange:(NSNotification *)notification {
}
}
}
- (void)dealloc
{
+ (void)load {
[super load];
Method origMethod = class_getInstanceMethod([self class], NSSelectorFromString(@"dealloc"));
Method newMethod = class_getInstanceMethod([self class], @selector(jk_textView_limit_swizzledDealloc));
method_exchangeImplementations(origMethod, newMethod);
}
- (void)jk_textView_limit_swizzledDealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self jk_textView_limit_swizzledDealloc];
}
//- (void)dealloc
//{
// [[NSNotificationCenter defaultCenter] removeObserver:self];
//}
@end
14 changes: 12 additions & 2 deletions JKCategories/UIKit/UITextView/UITextView+JKPlaceHolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ - (void)textViewDidEndEditing:(UITextView *)noti {
self.jk_placeHolderTextView.hidden = NO;
}
}
- (void)dealloc
{
+ (void)load {
[super load];
Method origMethod = class_getInstanceMethod([self class], NSSelectorFromString(@"dealloc"));
Method newMethod = class_getInstanceMethod([self class], @selector(jk_textView_placeholder_swizzledDealloc));
method_exchangeImplementations(origMethod, newMethod);
}
- (void)jk_textView_placeholder_swizzledDealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self jk_textView_placeholder_swizzledDealloc];
}
//- (void)dealloc
//{
// [[NSNotificationCenter defaultCenter] removeObserver:self];
//}
@end

0 comments on commit 4253e25

Please sign in to comment.