-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
When assigning a UISearchController
to navigationItem.searchController
, the search bar is displayed at the bottom of the view in iOS 26.0. When the search field becomes active, the keyboard pushes the entire view up instead of only adjusting for the search text field. (Conditionally) disabling IQKeyboardManager
fixes the issue.
To Reproduce
Steps to reproduce the behavior:
- Create a new view and set a distinct background color (e.g. blue)
- Embed the view in a navigation controller
- Assign an instance of
UISearchController()
tonavigationItem.searchController
- Tap on the search text field
The entire view is pushed upward when the keyboard appears. The system background color becomes visible behind the keyboard, while the view's background (blue) is cut off above it.
Expected behavior
Only the search bar's text field should adjust for the keyboard, not the entire view. However, this behavior is consistent with how IQKeyboardManager
handles layout adjustments, so it's technically correct.
Screenshots
Inactive | Active |
---|---|
![]() |
![]() |
Demo Project
N/A
Versions
Xcode: 26.0
Mac OS: 26.0
Simulator/Device: 26.0
Simulator/Device Name: iPhone 12
Library Version: 8.0.1
Additional context
While this might be the intended behavior of IQKeyboardManager
, it can be confusing when using navigationItem.searchController
on iOS 26.0.
If this isn't something that can be fixed within the library, I recommend pinning or documenting it to save others time finding the cause.
Workaround/fix
You can work around the issue by temporarily disabling IQKeyboardManager
while the text field is active, or inside viewWillAppear
/viewWillDisappear
on the view controller level:
extension MySearchController: UISearchBarDelegate {
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar) {
IQKeyboardManager.shared.isEnabled = false
}
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
IQKeyboardManager.shared.isEnabled = true
}
}