iOS 系统自带的短信软件 iMessage 和备忘录都是往下拉到键盘范围才会收起键盘,其实这个效果苹果已经封装好了,不需要自己实现。
UIScrollViewKeyboardDismissModeNone,
// dismisses the keyboard when a drag begins
UIScrollViewKeyboardDismissModeOnDrag,
// the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
// 键盘会跟随你的拉动而消失,如果要取消这个动作需要你再次往上拉
UIScrollViewKeyboardDismissModeInteractive,
只要让你的 ScrollView 的 keyboardDismissMode Property 设定为 UIScrollViewKeyboardDismissModeInteractive
就可以啦!
网友评论