美文网首页
UIScrollView处理键盘消失的小技巧

UIScrollView处理键盘消失的小技巧

作者: 天亮説晚安 | 来源:发表于2017-06-07 10:03 被阅读35次

当使用UIScrollView和其子类UITableView、UITextView之类的时候,可以简单的设置ScrollView的属性keyboardDismissMode,最低支持iOS7

typedef NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) {
    UIScrollViewKeyboardDismissModeNone,
    UIScrollViewKeyboardDismissModeOnDrag,      // dismisses the keyboard when a drag begins
    UIScrollViewKeyboardDismissModeInteractive, // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
} NS_ENUM_AVAILABLE_IOS(7_0);

UIScrollViewKeyboardDismissModeOnDrag
ScrollView拖动的时候消失

UIScrollViewKeyboardDismissModeInteractive
交互式效果,拖动ScrollView可以使键盘移出屏幕范围,可取消

相关文章

网友评论

      本文标题:UIScrollView处理键盘消失的小技巧

      本文链接:https://www.haomeiwen.com/subject/smsofxtx.html