键盘出现和消失,系统的通知
一般在viewWillAppear注册通知,在viewWillDisAppear解除通知
在键盘出现时,系统会发出通知,通知名为 UIKeyboardDidShowNotification ,注册通知即可
[[NSNotificationCenter defaultCenter] addObserve:self selector:@select (keyboardDidShow) name: UIKeyboardDidShowNotification object:nil]
在键盘消失时,系统会发出通知名为 UIKeyboardDidHideNotification 的通知
[[NSNotificationCenter defaultCenter] addObserve:self selector:@select (keyboardDidShow) name: UIKeyboardDidHideNotification object:nil]
本文介绍了iOS系统中键盘显示与隐藏的通知机制。通过注册UIKeyboardDidShowNotification和UIKeyboardDidHideNotification两个通知,开发者可以在键盘弹出及收起时执行相应操作。
766

被折叠的 条评论
为什么被折叠?



