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];

 

转载于:https://www.cnblogs.com/pretty-guy/p/4106731.html

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...