- UIKeyboardWillShowNotification;
- UIKeyboardDidShowNotification;
- UIKeyboardWillHideNotification;
- UIKeyboardDidHideNotification;
iOS5.0以后
- UIKeyboardWillChangeFrameNotification
- UIKeyboardDidChangeFrameNotification
ChangeFrame 可用于监听键盘的显示和隐藏
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| - (void)viewDidLoad { [super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil]; }
- (void)keyboardWillChangeFrame:(NSNotification *)note { NSLog(@"%@", note); }
|
1 2 3 4 5 6 7 8 9 10 11
| NSConcreteNotification 0x7fed62569a50 {name = UIKeyboardWillChangeFrameNotification; userInfo = { UIKeyboardAnimationCurveUserInfoKey = 7; UIKeyboardAnimationDurationUserInfoKey = "0.25"; UIKeyboardBoundsUserInfoKey = "NSRect: {{0, 0}, {414, 271}}"; UIKeyboardCenterBeginUserInfoKey = "NSPoint: {207, 871.5}"; UIKeyboardCenterEndUserInfoKey = "NSPoint: {207, 600.5}"; UIKeyboardFrameBeginUserInfoKey = "NSRect: {{0, 736}, {414, 271}}"; UIKeyboardFrameEndUserInfoKey = "NSRect: {{0, 465}, {414, 271}}"; UIKeyboardIsLocalUserInfoKey = 1; }}
|