iOS Keyboard 键盘高度变更 自适应
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification object:nil];
#pragma mark -
- (void)keyboardWillShow:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}
- (void)keyboardWillHide:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}
- (void)keyboardDidShow:(NSNotification*)aNotification
{
XuChiLog(@"%@", NSStringFromSelector(_cmd));
NSDictionary* info = [aNotification userInfo];
CGSize bkbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGSize ekbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size;
XuChiLog(@"beginkeyBoard Size: %@", NSStringFromCGSize(bkbSize));
XuChiLog(@" endkeyBoard Size: %@", NSStringFromCGSize(ekbSize));
}