监听键盘升降

 

 

 

 

   //注册键盘出现的通知

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

    

    

    

}

posted @ 2016-12-14 18:19  Da雪山  阅读(183)  评论(0编辑  收藏  举报