监听键盘的弹出与消失

来源:互联网 发布:人工智能的出现证明 编辑:程序博客网 时间:2024/04/29 22:28

//注册键盘出现的通知

    [[NSNotificationCenterdefaultCenter] addObserver:self

     

                                             selector:@selector(keyboardWasShown:)

     

                                                 name:UIKeyboardWillShowNotificationobject:nil];

    

    //注册键盘消失的通知

    [[NSNotificationCenterdefaultCenter] addObserver:self

     

                                             selector:@selector(keyboardWillBeHidden:)

     

                                                 name:UIKeyboardWillHideNotificationobject:nil];



- (void)keyboardWasShown:(NSNotification*)aNotification

{

    //键盘高度

    CGRect keyBoardFrame = [[[aNotificationuserInfo] objectForKey:UIKeyboardFrameEndUserInfoKey]CGRectValue];

    

}

-(void)keyboardWillBeHidden:(NSNotification*)aNotification


{

    

    

    

0 0
原创粉丝点击