Navigation bar appear over the views with new iOS7 SDK
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
When apps moved to iOS7 layout behavior, many screens suddenly rendered content under the navigation bar. The platform shifted toward full-screen layouts with translucent bars, so older frame assumptions no longer held. The long-term fix is safe-area-based layout, while legacy projects may still need transitional settings such as edge controls and bar translucency changes.
Why Content Appears Under the Navigation Bar
From iOS7 onward, view controllers can extend beneath top bars by default. If your content starts at origin without inset-aware constraints, top elements may sit behind the navigation bar.
This issue is common in migrated apps that mixed manual frame calculations with old assumptions about bar offsets.
Legacy Fix: Control Extended Edges
In older UIKit code, disabling extended edges can prevent drawing under bars.
This is a practical legacy workaround, but safe-area constraints are the preferred modern solution.
Modern Fix: Anchor to Safe Area
With Auto Layout, pin top content to safeAreaLayoutGuide, not to raw superview top.
This remains correct across notched devices, large titles, and orientation changes.
Scroll View and Table View Insets
Scroll-based screens need correct inset behavior. If automatic inset adjustment is disabled, content may slide under navigation bars.
If you choose .never, you must set top insets manually and keep them in sync with bar changes.
Navigation Bar Translucency Considerations
Translucent bars can visually overlap content even with valid constraints if backgrounds and insets are inconsistent.
For some legacy screens this simplifies migration, but non-translucent bars are not required when safe-area constraints are correct.
Storyboard Migration Checklist
Older storyboard constraints may target deprecated layout guides or direct superview top anchors. During migration:
- update top constraints to safe area.
- review scroll views for automatic inset behavior.
- test with large-title mode enabled.
- test with dynamic type and localization.
Large text and longer localized strings can reveal overlap issues that are invisible in short default content.
Additional Safe Area Insets for Custom UI
If your screen has custom overlays such as banners or floating headers, adjust additional safe area insets explicitly.
This is cleaner than hardcoding magic top constants in every constraint.
Test Across Device Variants
Navigation bar overlap bugs often appear only on specific devices and rotations. Minimum test matrix should include:
- small and large screen iPhones.
- notched devices.
- portrait and landscape.
- accessibility text sizes.
Automated UI snapshots can catch regressions after layout changes.
Common Pitfalls
- Mixing manual frames with Auto Layout safe-area constraints.
- Disabling automatic inset adjustment without manual compensation.
- Anchoring top views to superview top instead of safe area.
- Testing only one device size and missing notch-related overlap issues.
- Applying one-off constant offsets instead of fixing constraint strategy.
Summary
- iOS7 introduced layout behavior that can place content under navigation bars.
- Legacy edge settings can help, but safe-area constraints are the modern fix.
- Scroll-view inset behavior must match your layout strategy.
- Review storyboard constraints and translucency settings during migration.
- Validate across devices, orientations, and accessibility settings.

