automaticallyAdjustsScrollViewInsets was deprecated in iOS 11.0
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
automaticallyAdjustsScrollViewInsets was removed from the modern iOS layout model because safe areas replaced the old global inset behavior. If your project still relies on the old property, you may see content hidden under bars or extra top spacing on newer devices. The migration path is to use per scroll view inset adjustment rules and safe area aware constraints.
What Changed In iOS 11
Before iOS 11, one view controller level property controlled automatic inset behavior for embedded scroll views. Starting in iOS 11, each scroll view has its own contentInsetAdjustmentBehavior.
This gives finer control but requires explicit setup per screen.
Available behaviors:
.automaticfor default system handling,.alwaysto always include safe area,.neverto fully opt out,.scrollableAxesto adjust only for scrollable directions.
Most migration bugs come from leaving old assumptions in place while adding new safe area constraints.
Basic Migration Example
For a table view inside a normal controller, set behavior explicitly.
This is usually enough when constraints are already safe area based.
When You Need Manual Insets
Custom overlays, floating headers, or mixed bar visibility often require manual inset control.
If you choose .never, you now own all inset updates and should keep indicator insets in sync.
Navigation Controller Interactions
Insets can change when navigation bar visibility changes, large titles expand or collapse, or interactive transitions run. Test at least these flows:
- push and pop with large title enabled,
- modal presentation then dismiss,
- rotation and split view changes,
- keyboard appearance for forms inside scroll views.
Many teams test only static launch state and miss transition related spacing bugs.
Safe Area And Constraints Must Agree
Inset settings and Auto Layout constraints must be aligned. A common anti pattern is constraining scroll view content to superview top while also using automatic inset adjustment. That can produce double spacing.
Preferred baseline:
- pin scroll view frame to view edges,
- pin content layout guide correctly,
- rely on inset adjustment for bar avoidance.
If layout is fully custom, disable automatic adjustment and compute insets manually.
Legacy Compatibility Strategy
If you still support older iOS versions, keep version checks local and temporary. Do not spread compatibility branches across every controller.
Create a helper method or base controller that applies consistent inset policy. This reduces migration drift and makes future cleanup easier when minimum version increases.
Common Pitfalls
- Leaving deprecated property references in old controllers after migration.
- Applying both automatic adjustment and hardcoded top inset values.
- Updating content insets but forgetting scroll indicator insets.
- Testing only one device and missing notch and dynamic island safe area differences.
- Ignoring layout changes during navigation bar collapse and expansion.
Summary
- iOS 11 replaced global inset control with per scroll view behavior.
- Migrate by setting
contentInsetAdjustmentBehaviorintentionally on each screen. - Use safe area aware constraints and keep inset logic consistent.
- If opting out with
.never, manage both content and indicator insets yourself. - Validate transitions, device sizes, and keyboard scenarios to catch real layout regressions.

