Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IQKeyboardManager not disabling

Trying to disable IQKeyboardManager for a particular ViewController or for the whole app, it's not working.

My AppDelegate code:

[[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];
[[IQKeyboardManager sharedManager] setEnable:NO];
[[IQKeyboardManager sharedManager] disableToolbarInViewControllerClass:[TCChatViewController class]];
[[IQKeyboardManager sharedManager] disableInViewControllerClass:[TCChatViewController class]];

Also trying to disable in viewWillAppear: :

[[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];
[[IQKeyboardManager sharedManager] setEnable:NO];
like image 375
Dima Cheverda Avatar asked Dec 09 '22 02:12

Dima Cheverda


1 Answers

Disable IQKeyboard Manager In Objective C

If you want to disable IQKeyboardManager in particular controller of your project. Then add this line in your viewController Class.

 #import "IQKeyboardManager.h"

Now In View Controller viewDidLoad Methods, add the below function

[[IQKeyboardManager sharedManager] setEnableAutoToolbar:false];

Now when you leave the controller, so that your IQKeyboardManager will enable when you leave that viewController**.

In **viewWillDisappear** Method:-

[[IQKeyboardManager sharedManager] setEnableAutoToolbar:true];

Disable IQKeyboard Manager In Swift 3.0

import IQKeyboardManagerSwift

 override func viewDidLoad() {
    super.viewDidLoad()
    IQKeyboardManager.sharedManager().enableAutoToolbar = false
    IQKeyboardManager.sharedManager().enable = false
}

 //MARK:- viewWillDisappear
 override func viewWillDisappear(_ animated: Bool) {
    IQKeyboardManager.sharedManager().enableAutoToolbar = true
    IQKeyboardManager.sharedManager().enable = true
}

Disable IQKeyboard Manager In Swift 4.2

import IQKeyboardManagerSwift

 override func viewDidLoad() {
    super.viewDidLoad()
    IQKeyboardManager.shared.enableAutoToolbar = false
    IQKeyboardManager.shared.enable = false
}

 //MARK:- viewWillDisappear
 override func viewWillDisappear(_ animated: Bool) {
    IQKeyboardManager.shared.enableAutoToolbar = true
    IQKeyboardManager.shared.enable = true
}
like image 52
Mandeep Singh Avatar answered Dec 22 '22 03:12

Mandeep Singh