I\'m using the IQKeyboardManger library to scroll text fields when started typing using the keyboard, but I don\'t want to display the default toolbar from their library. Be
You can enable or disable the toolbar in didFinishLaunchingWithOptions
of AppDelegate
:
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = false
For more info see Properties and functions usage
This is the way to do it for an individual view controller:
class YourViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
IQKeyboardManager.shared.disabledToolbarClasses = [YourViewController.self]
}
}
And to prevent the vc from rising when IQKeyboardManager raises it when the keyboard is present:
IQKeyboardManager.shared.disabledDistanceHandlingClasses.append(YourViewController.self)
Swift 5, IQKeyboardManager (6.3.0)
You can call this setup function from your didFinishLaunchingWithOptions
in the app delegate:
private func setupKeyboardManager() {
IQKeyboardManager.shared().isEnabled = true
IQKeyboardManager.shared().isEnableAutoToolbar = false
IQKeyboardManager.shared().shouldShowToolbarPlaceholder = false
IQKeyboardManager.shared().previousNextDisplayMode = .alwaysHide
}
Feel free to add any other customisation you need in this method, such as shouldResignOnTouchOutside
or similar.
Swift 5.1, Xcode 11
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = false
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = false
IQKeyboardManager.shared.shouldResignOnTouchOutside = true
return true
}