Overview
The IQKeyboardToolbarManager subspec provides an automatic toolbar above the keyboard with Previous/Next/Done buttons, allowing users to navigate between text fields without dismissing the keyboard.As of version 7.0+, IQKeyboardToolbarManager is now available as an independent library. The integration with IQKeyboardManager is deprecated but still functional.
Installation
CocoaPods
Podfile
Swift Package Manager
Add the IQKeyboardToolbarManager package separately:Basic Setup
Toolbar Configuration
Access toolbar configuration through thetoolbarConfiguration property:
AppDelegate.swift
Navigation Methods
Programmatic Navigation
Navigate between text fields programmatically:ViewController.swift
Check Navigation Availability
ViewController.swift
Class-Level Control
Disable Toolbar for Specific View Controllers
AppDelegate.swift
Force Enable for Specific Classes
AppDelegate.swift
Sound Effects
Enable input click sounds when toolbar buttons are tapped:AppDelegate.swift
Deep Responder Navigation
Allow navigation between text fields in different container views:AppDelegate.swift
Toolbar Debugging
Enable debug logging for toolbar operations:AppDelegate.swift
Example: Custom Form with Toolbar
FormViewController.swift
Toolbar Behavior
The toolbar automatically:- Shows Previous button when there’s a previous text field
- Shows Next button when there’s a next text field
- Disables buttons when navigation is not possible
- Shows Done button to dismiss the keyboard
- Updates state when text fields change
Customizing Button Behavior
While the toolbar is automatic, you can customize button actions by:- Using the standalone IQKeyboardToolbarManager library
- Implementing custom toolbar with
inputAccessoryView - Handling return key navigation (see Return Key Handling)
Toolbar vs Return Key Navigation
Toolbar Navigation
- Visible Previous/Next/Done buttons
- User taps buttons to navigate
- Keyboard stays visible
- Better for long forms
Return Key Navigation
- Uses Return key to advance
- More natural typing flow
- Automatically changes return key type
- Better for short forms
Troubleshooting
Toolbar not appearing
Toolbar not appearing
- Verify
enableAutoToolbaris set totrue - Check if the view controller is in
disabledToolbarClasses - Ensure you’re using UITextField or UITextView
- Enable toolbar debugging:
IQKeyboardManager.shared.enableToolbarDebugging = true
Previous/Next buttons not working
Previous/Next buttons not working
Toolbar appearance issues
Toolbar appearance issues
- Configure
toolbarConfigurationin AppDelegate - Check for conflicts with custom
inputAccessoryView - Verify tint colors are visible against toolbar background
Migration to Standalone Library
If you’re migrating to the standalone IQKeyboardToolbarManager:AppDelegate.swift
Next Steps
Return Key Handling
Navigate using the Return key
Appearance Customization
Customize keyboard appearance
Advanced Configuration
Fine-tune keyboard behavior
Debugging
Troubleshoot toolbar issues