Features
- Automatic handling of UITextField/UITextView focusing events
- Automatic scrolling of focused UITextField/UITextView to visible area when keyboard appears
- Automatic addition of a done button as inputAccessoryView for UITextField/UITextView
- Preventing UITextField/UITextView from being hidden behind the keyboard
- Support for customizing various keyboard behavior and appearance settings
- Seamless integration with existing codebases
- Simplified keyboard management for large iOS applications
Requirements
- iOS 10.0+
- Xcode 10.0+
- Swift 4+
- CocoaPods
Installation
- Install IQKeyboardManager using CocoaPods:
“`ruby
pod ‘IQKeyboardManagerSwift’
“`
- Import IQKeyboardManagerSwift in your application delegate:
“`swift
import IQKeyboardManagerSwift
“`
- Initialize IQKeyboardManager in application(_:didFinishLaunchingWithOptions:) method:
“`swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
IQKeyboardManager.shared.enable = true
return true
}
“`
Usage
Basic Configuration
To enable basic keyboard management using the default settings, simply set the enable
property of IQKeyboardManager.shared to true
in your application delegate’s application(_:didFinishLaunchingWithOptions:)
method:
“`swift
IQKeyboardManager.shared.enable = true
“`
Customization
IQKeyboardManager offers a wide range of customization options to suit different requirements. Some commonly used customization options include:
- Setting toolbarTintColor property to change the color of the toolbar.
- Disabling the automaticToolbar property to hide the toolbar.
- Disabling the previousNextDisplayMode property to hide the previous/next buttons in the toolbar.
- and much more…
For detailed information on customization options and usage, refer to the official GitHub repository of IQKeyboardManager.
Support
For support, bug reports, feature requests, or general inquiries, please visit the official GitHub repository of IQKeyboardManager.