Laying out views for landscape in an Objective-C app comes down to one rule: never let a fixed portrait frame travel into a landscape pass unchanged. Instead, express layout as relationships that a constraint or autoresizing mask can re-solve when the bounds swap, or rebuild frames from the new bounds inside viewWillTransitionToSize:withTransitionCoordinator:. If your screens only shift position slightly, autoresizing masks and UIStackView are enough. If the composition itself changes, such as a sidebar appearing beside content, you need size-class-aware constraints activated in traitCollectionDidChange: or a full child view-controller swap.
This guide covers the UIKit path that most Objective-C codebases still live in, with notes where AppKit on macOS differs. It assumes you're supporting rotation on iPhone and iPad, including multitasking sizes, and that you've already decided which orientations your target supports.
Decide Whether You're Adapting or Recomposing
Before touching code, classify each screen. Adaptation means the same view hierarchy rearranges: a button row wraps, a label grows, an image shifts to the side. Recomposing means different content or a different container: a split view instead of stacked views, a tab bar hidden in landscape on a compact-height phone, or a table becoming a grid.
Adaptation is cheaper and usually the right answer for forms, settings, and detail pages. Recomposing is justified for media players, editors, games, and dashboards where landscape genuinely changes what the user can do. Write the classification down per screen; it decides whether you write constraints, autoresizing masks, or a child-controller container.
Two orientation facts drive everything. On iPhone, landscape on most models means a compact height size class, so a vertically scrolling stack can become cramped. On iPad, landscape puts you in a regular width and regular height class unless you're in a split-screen multitasking pane, where width can drop to compact. That's why hard-coded checks like "width greater than height means iPad" break in Slide Over and Split View.
Also confirm what your app declares in the Info.plist. UISupportedInterfaceOrientations and UISupportedInterfaceOrientations~ipad gate which orientations the system will even offer. If landscape never appears during testing, check those keys and the view controller's supportedInterfaceOrientations before debugging layout.
Prerequisites Before You Change Any Layout Code
Get these in place first, because they affect how your fixes behave:
1: Set deployment-target-appropriate orientation support in Info.plist, and override supportedInterfaceOrientations and shouldAutorotate on any custom container controllers. 2: Build and run on a real device or a simulator that you actually rotate, not just resize. Simulator rotation via the Hardware menu exercises the same callbacks. 3: Establish a baseline: take screenshots in portrait and landscape of every screen you plan to touch, on the smallest phone you support and on an iPad in both full screen and Split View. 4: Identify the layout engine per screen. If you see setFrame: calls in viewDidLayoutSubviews, note them; they'll fight constraints and must be reconciled. 5: If the app targets iOS 13 or later for iPad, plan for multiple windows and scene-based lifecycles, since size changes now arrive through scene and trait callbacks rather than only through rotation notifications.
The success check for this phase is simple: you can reproduce each layout problem on demand by rotating, so you know when a fix actually works.
Choose Your Layout Mechanism Before Writing Constraints
There are three mechanisms in UIKit, and mixing them carelessly is the most common source of landscape bugs.
Auto Layout constraints express relationships and re-solve automatically when bounds change. They're the default for anything with more than a handful of views.
Autoresizing masks are the older springs-and-struts system. They're fast and simple but only express "pin to edges" and "flexible width or height" relationships. A view using translatesAutoresizingMaskIntoConstraints = YES gets its mask converted into constraints, which is fine until you also add your own constraints to that view, causing conflicts.
Manual frames in layoutSubviews or viewDidLayoutSubviews are sometimes unavoidable for custom drawing, collection view layouts, or performance-critical scrolling content. They work in landscape only if you compute from bounds, never from stored constants.
A workable rule: use Auto Layout for the view-controller-level composition, UIStackView for linear groups, and manual frames only inside leaf views that draw themselves. Keep each view in exactly one system. If a view has translatesAutoresizingMaskIntoConstraints = NO, do not set its frame directly.
One more mechanism matters in landscape: UIStackView's axis property. You can flip a stack from vertical in portrait to horizontal in landscape by setting stackView.axis = .horizontal, which is often the single cheapest landscape adaptation available, especially for button rows and label-value pairs.
Write Constraints That Survive the Bounds Swap
Constraints don't need to know about orientation. They need to be unambiguous in every size. The tricks below keep them that way.
Anchor to safe areas, not the raw view. Use view.safeAreaLayoutGuide for top and bottom anchors so the notch, Dynamic Island, and home indicator are handled in both orientations. Note that safe-area insets differ between portrait and landscape on notched phones, and the left/right insets in landscape are usually larger. Constraints tied to the safe area adapt automatically.
Avoid equality constraints on width or height when the content should flex. A label pinned with width == 320 breaks visually in landscape on a phone. Prefer lessThanOrEqualTo with a priority below required, plus content-hugging and compression-resistance settings so the label can grow or shrink as needed.
Use priorities rather than constant swaps. When a horizontal layout becomes cramped in landscape, a low-priority constraint that held two views side by side can be deactivated in favor of a higher-priority arrangement. But don't toggle constraints imperatively in viewWillLayoutSubviews if you can express it through priorities and size-class activation instead.
Anchor the bottom of scrollable content to the scroll view's content layout guide, not to the safe area. In landscape on phones, vertical space shrinks and content must scroll; if you've pinned a button to the bottom of the screen outside the scroll view, you've reduced the visible content area further and may trigger a constraint conflict.
Test at the smallest supported size. A landscape iPhone 15 in its smallest split width, or an iPhone SE in landscape, is where ambiguous constraints reveal themselves. Enable the "Ambiguous Layout" runtime check in Xcode's scheme or call _autolayoutTrace during debugging to find views with unsatisfiable or under-constrained positions.
Success check: rotate with the debugger paused on a constraint breakpoint and confirm no Unable to simultaneously satisfy constraints messages appear in the console for your views.
Reposition Programmatically When Orientation Actually Changes
Sometimes constraints can't express the change and you need code. The modern callback is viewWillTransitionToSize:withTransitionCoordinator:, which is called on the view controller during any size change, including rotation, iPad multitasking, and split-screen resizing. It replaces the older willRotateToInterfaceOrientation:duration:, which is deprecated and doesn't fire for multitasking size changes.
Inside applyLandscapeLayout:, change only things constraints can't express: UIStackView.axis, which constraint sets are active, which child view controller is visible, or whether a sidebar exists. Do not set frames here for Auto Layout views; let the layout engine re-solve.
For a container controller that swaps child view controllers on rotation, deactivate old constraints, call removeFromParentViewController, then addChildViewController: the new child and pin its view with fresh constraints. Use the transition coordinator's transitionDuration if you animate.
Success check: rotate from portrait to landscape and back without the layout jumping on the second pass. A layout that looks right only the first time usually means you're mutating state in viewWillTransitionToSize: rather than idempotently reapplying it.
Use Size Classes and Traits Instead of Guessing Orientation
Orientation and size class are not the same thing, and relying on orientation is why iPad multitasking layouts break. In traitCollectionDidChange:, compare horizontal and vertical size classes and adjust:
setWideLayoutActive: should toggle a stored array of active constraints and, if needed, stackView.axis. Keep the toggling idempotent so repeated callbacks don't stack.
On iPhone in landscape, horizontalSizeClass is usually compact on most models, so "wide" isn't the signal you want; use size.width > size.height from the transition callback for the orientation signal and size classes for the iPad composition signal. Keep both concepts separate in your code so a future reviewer can tell which problem each solves.
Success check: run on iPad in full screen, Split View, and Slide Over, and rotate each. The layout should respond to width, not to a hard-coded iPad check.
Handle Landscape on the Phone Compactly
Phones in landscape are the hardest case because vertical space shrinks dramatically while horizontal space grows. Common adaptations:
Set the stack axis to horizontal when the stack contains a small number of items that fit side by side, such as three action buttons or a label-value pair. Hide the navigation bar in landscape for media viewing, then restore it on rotation, using setNavigationBarHidden:animated: inside the transition coordinator's animation block. Collapse a header or hero image. A large image that dominates portrait often needs a height constraint that is lessThanOrEqualTo the view's height multiplied by a fraction, so it scales down in landscape without disappearing. Let content scroll. If the portrait form fit without scrolling, landscape may not fit. Wrap content in a UIScrollView with contentInsetAdjustmentBehavior set appropriately, and pin the content stack's width to the scroll view's frame so it doesn't collapse. Check the status bar and safe areas. On notched phones, landscape left and right safe-area insets can be around 44 points, so content pinned to the raw view edges will sit under rounded corners.
A concrete example: a sign-in form with a logo, two fields, and a button. Portrait fits comfortably. In landscape on a phone, stacking the fields horizontally next to the logo frees the vertical space the button needs. That's a UIStackView.axis change plus a constraint switch keyed off size.width > size.height, not a full recomposition.
iPad Landscape and Multitasking Sizes
On iPad, landscape in full screen is regular width and regular height, which makes it the natural home for sidebars, split layouts, and multi-column grids. But the same code path must survive Split View widths and Slide Over compact widths.
The practical pattern is a two-column composition in wide layouts and a single-column stack in narrow ones, with both constraint sets built once and toggled by size class. If you're using UISplitViewController, set preferredDisplayMode to UISplitViewControllerDisplayModeAllVisible or Automatic depending on whether you want the sidebar visible in landscape; the system handles a lot of the resizing. primaryEdge and presentsWithGesture control where the sidebar sits and whether it can be dragged over.
Apple's newer layout containers, such as UICollectionViewCompositionalLayout, are also useful here because you can define sections whose item widths differ by environment. A compositional layout with a fractionalWidth group recomputes columns from the container width automatically, so a grid that shows two columns in portrait and three in landscape needs no rotation code at all. This is genuinely different from older UICollectionViewFlowLayout code, which often requires invalidateLayout inside the transition callback to recompute item sizes.
Success check: on iPad, open the app in full-screen portrait, rotate to landscape, then enter Split View, Slide Over, and full screen again. The sidebar should appear and disappear without overlapping content or leaving gaps.
Troubleshooting Landscape Layouts When They Break
Symptom: views overlap in landscape. Likely cause: an equality constraint on width combined with required-priority constraints that can't all be satisfied, or a view pinned to the raw edges instead of the safe area. Reversible check: temporarily set all suspect constraints' priority to UILayoutPriorityDefaultHigh and see whether the layout becomes ambiguous instead of conflicting.
Symptom: content is cut off at the bottom in landscape. Likely cause: the vertical stack or scroll content pinned its bottom to the view rather than the safe area, or an image kept a fixed portrait height. Reversible check: add a scroll view around the content and confirm the content becomes reachable.
Symptom: layout is wrong only after the second rotation. Likely cause: non-idempotent constraint toggling, such as appending constraints to an array each time the callback fires. Reversible check: log constraints.count before and after each rotation; it should return to the starting value.
Symptom: a child view controller's view is the wrong size. Likely cause: it was added to the hierarchy but its view's constraints were never pinned, so it kept its old bounds. Reversible check: print child.view.frame and child.view.superview.bounds on rotation; they should match after layout.
Stop condition: if your only remaining bug is a constraint conflict inside a third-party view whose source you can't change, resolve it through a lower-priority local constraint before you consider contact with the vendor's support. If you're seeing inconsistent behavior across OS versions rather than across orientations, that's an OS bug investigation, not a landscape layout problem.
A Worked Estimate for Recomposition Cost
A worked example helps set expectations. Suppose you have twelve screens, and eight need only axis swaps or safe-area fixes, three need a sidebar composition, and one is a media player that hides chrome. The eight straightforward screens are mostly a set of constraint priority changes and one stack-axis line each; the three compositions need two constraint sets plus a container controller; the media player needs a bar-hiding block. This is illustrative arithmetic, not a measured benchmark, but it's the reason to classify screens before coding: the recomposition bucket is where the time goes, and knowing it's one screen rather than twelve changes whether you write a dedicated landscape layout or avoid landscape support entirely for that module.
Also account for the test matrix. Each adapted screen needs at minimum a small phone, a large phone, and an iPad in two multitasking modes, in both orientations, which is more combinations than portrait-only testing. That's a real cost controlled by keeping the composition count low.
What to Check Before You Ship
Run through this list once your fixes are in:
1: Rotate every screen in both directions on the smallest and largest supported phone. 2: Test iPad full screen, Split View, and Slide Over, rotating within each. 3: Confirm no constraint-conflict logs in the console during rotation. 4: Confirm content is reachable, either by fitting or by scrolling, in landscape at the largest Dynamic Type setting. 5: Verify buttons and controls remain large enough to tap comfortably, since horizontal slimming can shrink targets. 6: Check state preservation across rotation, such as text typed into a field, which should survive because the view controller isn't recreated. 7: Test the deprecated orientation APIs, if any remain, and confirm they aren't the only path invoked.
If a screen genuinely can't work in landscape, the honest answer is to restrict its supportedInterfaceOrientations to portrait rather than shipping a broken layout. That's a legitimate design decision, and it's clearer than a stretched portrait form.
FAQ
Does autoresizing mask still work in modern apps? Yes, and mask-to-constraint conversion is fine for simple views. The trouble comes when you mix masks and manual constraints on the same view or override a mask-converted frame; pick one system per view.
Should I use viewWillTransitionToSize: or traitCollectionDidChange:? Use the transition callback for orientation-dependent changes like stack axis, and traits for composition changes tied to width class, especially on iPad. They answer different questions.
Why does the keyboard cover my field in landscape? Vertical space shrinks while the keyboard height changes in landscape, so a field pinned near the bottom can end up underneath it. Scroll the field into view in response to keyboard notifications and pin content to the safe area's bottom rather than the view's.
Does SwiftUI change any of this? It handles rotation layout more automatically, but the underlying size-class and safe-area concepts are the same, and Objective-C UIKit apps still need the patterns above. Mixed codebases should make sure the same orientation constraints are declared consistently on both sides.