mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-04-27 15:07:44 +00:00
add a cheesy button to hide the keyboard
This commit is contained in:
parent
b0da683d1f
commit
a84bd41d58
1 changed files with 24 additions and 0 deletions
|
|
@ -166,6 +166,8 @@
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
||||||
[notificationCenter addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
|
[notificationCenter addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil];
|
||||||
|
[notificationCenter addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
|
||||||
|
[notificationCenter addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
|
||||||
if ([self pasteboardHasLink]) {
|
if ([self pasteboardHasLink]) {
|
||||||
[self configureLinkView];
|
[self configureLinkView];
|
||||||
}
|
}
|
||||||
|
|
@ -175,6 +177,8 @@
|
||||||
[super viewWillDisappear:animated];
|
[super viewWillDisappear:animated];
|
||||||
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
||||||
[notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
[notificationCenter removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
||||||
|
[notificationCenter removeObserver:self name:UIKeyboardWillShowNotification object:nil];
|
||||||
|
[notificationCenter removeObserver:self name:UIKeyboardWillHideNotification object:nil];
|
||||||
[self savePost];
|
[self savePost];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,8 +197,28 @@
|
||||||
- (void)applicationWillResignActive:(NSNotification *)note {
|
- (void)applicationWillResignActive:(NSNotification *)note {
|
||||||
[self savePost];
|
[self savePost];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)keyboardWillShow:(NSNotification *)note {
|
||||||
|
[self showHideKeyboardButton];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)keyboardWillHide:(NSNotification *)note {
|
||||||
|
[self hideHideKeyboardButton];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
|
- (void)showHideKeyboardButton;
|
||||||
|
{
|
||||||
|
UIBarButtonItem *hideKeyboardItem = [[UIBarButtonItem alloc] initWithTitle:@"^^" style:UIBarButtonItemStylePlain target:self.textView action:@selector(resignFirstResponder)];
|
||||||
|
self.navigationItem.rightBarButtonItem = hideKeyboardItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)hideHideKeyboardButton;
|
||||||
|
{
|
||||||
|
self.navigationItem.rightBarButtonItem = nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)isDirty;
|
- (BOOL)isDirty;
|
||||||
{
|
{
|
||||||
return self.modifiedPost.new || ![self.modifiedPost isEqualToPost:self.post];
|
return self.modifiedPost.new || ![self.modifiedPost isEqualToPost:self.post];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue