iOS 监听键盘变化

   //将要显示键盘
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willShowKeyboard:) name:UIKeyboardWillShowNotification object:nil];
    //将要隐藏键盘
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willHideKeyboard:) name:UIKeyboardWillHideNotification object:nil];
    //显示键盘完成
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(DidShowKeyboard:) name:UIKeyboardDidShowNotification object:nil];
    //隐藏键盘完成
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(DidHideKeyboard:) name:UIKeyboardDidHideNotification object:nil];
    //键盘frame将要改变
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidChange:) name:UIKeyboardDidChangeFrameNotification object:nil];
    //键盘frame将要改变
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil];

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。