// 在"AppDelegate.m"里
#import "IQKeyboardManager.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
manager.enable = YES;// 是否整个app都启用
manager.shouldResignOnTouchOutside = YES;//这个是点击空白区域键盘收缩的开关
manager.enableAutoToolbar = NO;//这个是它自带键盘工具条开关
return YES;
}
//导入ZYKeyboardUtil 第三方
// 在控制器中
// 创建一个对象
self.keyboardUtil = [[ZYKeyboardUtil alloc] init];
// 防止循环引入
__weak ViewController *weakSelf = self;
// adaptiveViewHandleWithController:当前页面的控制器
// adaptiveView:输入框,可以是一个 也可以是多个。
[_keyboardUtil setAnimateWhenKeyboardAppearAutomaticAnimBlock:^(ZYKeyboardUtil *keyboardUtil) {
[keyboardUtil adaptiveViewHandleWithController:weakSelf adaptiveView:weakSelf.firstTF,weakSelf.fourTF,weakSelf.sectionTF,weakSelf.fiveTF, nil];
}];