您的位置:首页 > 运维架构

监控键盘出现和消失,获取键盘高度

2017-01-13 15:56 351 查看
//注册键盘出现的通知

[[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