UITableView滚动时键盘消失

当使用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可以使键盘移出屏幕范围,可取

你可能感兴趣的:(UITableView滚动时键盘消失)