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

2017-01-13 19:22:48来源:CSDN作者:sxq609004460人点击

//注册键盘出现的通知    [[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{}

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台