//注册键盘出现的通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardWillShowNotification object:nil];
//注册键盘消失的通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
- (void)keyboardWasShown:(NSNotification*)aNotification
{
//键盘高度
CGRect keyBoardFrame = [[[aNotification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
}
-(void)keyboardWillBeHidden:(NSNotification*)aNotification
{
}
本文探讨了在iOS应用中如何注册键盘显示与隐藏的通知,包括获取键盘高度的方法,并提供了相应的Swift代码实现。
788

被折叠的 条评论
为什么被折叠?



