全局隐藏键盘
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
滚动ScrollView隐藏键盘
scrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
点击ScrollView隐藏键盘
//加一个tap手势
tap.cancelsTouchesInView = YES
//然后在响应方法中写上
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
网友评论