本文来源于 http://www.jianshu.com/p/01c0682003a9
// iOS delegate内应用入口
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//关闭设置为NO, 默认值为NO.
[IQKeyboardManager sharedManager].enable = YES;
}
// 点击背景收起键盘
[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
// 隐藏键盘上的工具条(默认打开)
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
// 某一个输入框特定不需要键盘上的工具条时
textField.inputAccessoryView = [[UIView alloc] init];
// 如果因为不知名的原因需要在某个页面禁止自动键盘处理事件响应
- (void) viewWillAppear: (BOOL)animated {
//打开键盘事件相应
[IQKeyboardManager sharedManager].enable = NO;
}
- (void) viewWillDisappear: (BOOL)animated {
//关闭键盘事件相应
[IQKeyboardManager sharedManager].enable = YES;
}
网友评论