Overview
The UIScrollView extensions provide fine-grained control over how scroll views behave when the keyboard appears. These extensions allow you to customize scrolling behavior and content inset adjustments on a per-scrollview basis. All properties are accessed through the.iq namespace:
Properties
If
true, the scrollview will ignore scrolling adjustments for positioning text input views.When enabled, IQKeyboardManager will not automatically scroll this scroll view to make the active text field visible. The scroll view will remain at its current position.Use when:- You want to handle scrolling manually
- The scroll view has custom scrolling behavior
- You don’t want automatic scrolling for specific scroll views
If
true, the scrollview will ignore content inset adjustments when the keyboard is shown.When enabled, IQKeyboardManager will not modify the contentInset of this scroll view when the keyboard appears or disappears.Use when:- You manage content insets manually
- The scroll view has custom inset behavior (e.g., for navigation bars)
- You want to prevent conflicts with other inset adjustments
If
true, the scroll view’s contentOffset will be restored to its initial position when the keyboard is dismissed.This ensures that the scroll view returns to exactly where it was before the keyboard appeared, rather than staying at the adjusted position.Use when:- You want the scroll view to return to its original position
- You’re implementing forms where the user should see the top after editing
- You need consistent scroll position before and after keyboard interaction
Available Properties Summary
| Property | Type | Default | Description |
|---|---|---|---|
ignoreScrollingAdjustment | Bool | false | Prevents automatic scrolling to visible |
ignoreContentInsetAdjustment | Bool | false | Prevents content inset modifications |
restoreContentOffset | Bool | false | Restores scroll position on dismiss |
Usage Examples
Custom Scrolling with Manual Control
TableView with Custom Insets
Form with Reset on Keyboard Dismiss
Complex Layout with Mixed Behavior
Scroll View with Fixed Header
When to Use Each Property
ignoreScrollingAdjustment
Use this when:
- Implementing custom keyboard avoidance logic
- Working with complex nested scroll views
- The default scrolling behavior conflicts with your UI design
- You want scroll views to stay exactly where they are
- You want the standard behavior of scrolling to make text fields visible
- You don’t have specific scrolling requirements
ignoreContentInsetAdjustment
Use this when:
- Managing
contentInsetmanually for navigation/tab bars - Using custom inset animations
- The scroll view has fixed content that shouldn’t shift
- Experiencing inset conflicts with other libraries
- You want IQKeyboardManager to handle all inset adjustments
- Your scroll view has standard behavior
restoreContentOffset
Use this when:
- Building forms that should reset to the top
- Creating wizards or multi-step input flows
- Users should always see the full content after editing
- Implementing “return to start” UX patterns
- Users should continue from where they left off
- You want to preserve scroll position during editing sessions
- Working with long lists where returning to top is disruptive
See Also
- UIView Extensions - General view extensions
- Configuration - Global keyboard manager settings
- Toolbar Configuration - Toolbar customization