iOS开发_IQKeyboardManager的启用/禁用

  • 在某个界面完全禁用 IQKeyboard

- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];

	// 页面appear 禁用
	[IQKeyboardManager sharedManager].enable = NO;
}

- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];

	// 页面Disappear 启用
	[IQKeyboardManager sharedManager].enable = YES;
}
  • 在某个界面完全禁用 IQKeyboard 的 Toolbar (完成、切换箭头)

- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];

	// 页面appear 禁用
	[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
}

- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];

	// 页面Disappear 启用
	[IQKeyboardManager sharedManager].enableAutoToolbar = YES;
}
  • 在某个界面完全禁用IQKeyboard 的 Toolbar 的 切换箭头(切换输入框)

typedef NS_ENUM(NSUInteger, IQPreviousNextDisplayMode) {
	// 默认一界面多输入框显示切换箭头  单输入框不显示
	IQPreviousNextDisplayModeDefault,    
	// 隐藏切换箭头    
	IQPreviousNextDisplayModeAlwaysHide,     
	// 一直显示切换箭头(不受输入框个数限制) 
	IQPreviousNextDisplayModeAlwaysShow,     
};

- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];

	// 页面appear 禁用
	[IQKeyboardManager sharedManager].previousNextDisplayMode = IQPreviousNextDisplayModeAlwaysHide;
}

- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];

	// 页面Disappear 启用
	[IQKeyboardManager sharedManager].previousNextDisplayMode = IQPreviousNextDisplayModeAlwaysShow;
}
posted @ 2024-07-24 15:47  CH520  阅读(120)  评论(0编辑  收藏  举报