update link view when the pasteboard changes or app becomes active

This commit is contained in:
Sami Samhuri 2015-05-03 23:58:19 -07:00
parent 085607795b
commit 1cfebee54e

View file

@ -185,6 +185,8 @@
NSAssert(self.blogController, @"blogController is required");
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
[notificationCenter addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter addObserver:self selector:@selector(configureLinkView) name:UIPasteboardChangedNotification object:nil];
[notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[notificationCenter addObserver:self selector:@selector(postDeleted:) name:DraftRemovedNotification object:nil];
@ -196,6 +198,8 @@
[super viewWillDisappear:animated];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[notificationCenter removeObserver:self name:UIPasteboardChangedNotification object:nil];
[notificationCenter removeObserver:self name:UIKeyboardWillShowNotification object:nil];
[notificationCenter removeObserver:self name:UIKeyboardWillHideNotification object:nil];
[notificationCenter removeObserver:self name:DraftRemovedNotification object:nil];
@ -223,6 +227,12 @@
}
}
- (void)applicationDidBecomeActive:(NSNotification *)note {
if (self.post) {
[self configureView];
}
}
- (void)keyboardWillShow:(NSNotification *)note {
if (self.textView.isFirstResponder) {
[self showHideKeyboardButton];