Last active
February 19, 2018 15:09
-
-
Save DonMag/ea986e5b37225ac9a84d5fbb147f199d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FirstTabKBViewController.m | |
// OCVeryTemp | |
// | |
// Created by Don Mag on 2/19/18. | |
// | |
#import "FirstTabKBViewController.h" | |
@interface FirstTabKBViewController () | |
@end | |
@implementation FirstTabKBViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view. | |
} | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
// Listen for keyboard appearances and disappearances | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardDidShow:) | |
name:UIKeyboardDidShowNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardDidHide:) | |
name:UIKeyboardDidHideNotification | |
object:nil]; | |
} | |
- (void)viewWillDisappear:(BOOL)animated { | |
NSLog(@"FIRST view will dis"); | |
[super viewWillDisappear:animated]; | |
[[NSNotificationCenter defaultCenter] removeObserver:self | |
name:UIKeyboardDidHideNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] removeObserver:self | |
name:UIKeyboardDidShowNotification | |
object:nil]; | |
} | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
[[self view] endEditing:TRUE]; | |
} | |
- (void)keyboardDidShow: (NSNotification *) notif{ | |
// Do something here | |
NSLog(@"FIRST kb did show"); | |
} | |
- (void)keyboardDidHide: (NSNotification *) notif{ | |
// Do something here | |
NSLog(@"FIRST kb did hide"); | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SecondTabKBViewController.m | |
// OCVeryTemp | |
// | |
// Created by Don Mag on 2/19/18. | |
// | |
#import "SecondTabKBViewController.h" | |
@interface SecondTabKBViewController () | |
@end | |
@implementation SecondTabKBViewController | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view. | |
} | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
// Listen for keyboard appearances and disappearances | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardDidShow:) | |
name:UIKeyboardDidShowNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(keyboardDidHide:) | |
name:UIKeyboardDidHideNotification | |
object:nil]; | |
} | |
- (void)viewWillDisappear:(BOOL)animated { | |
NSLog(@"SECOND view will dis"); | |
[super viewWillDisappear:animated]; | |
[[NSNotificationCenter defaultCenter] removeObserver:self | |
name:UIKeyboardDidHideNotification | |
object:nil]; | |
[[NSNotificationCenter defaultCenter] removeObserver:self | |
name:UIKeyboardDidShowNotification | |
object:nil]; | |
} | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
[[self view] endEditing:TRUE]; | |
} | |
- (void)keyboardDidShow: (NSNotification *) notif{ | |
// Do something here | |
NSLog(@"SECOND kb did show"); | |
} | |
- (void)keyboardDidHide: (NSNotification *) notif{ | |
// Do something here | |
NSLog(@"SECOND kb did hide"); | |
} | |
@end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment