UIScene 如何适配
Asked on 06/13/2025
1 search
To adapt UIScene
in your UIKit app, you can follow several strategies discussed in the WWDC sessions:
-
UI Scene Size Restrictions: You can use the UI Scene Size Restrictions API to express the preferred minimum size of your scene's content. This is particularly useful when your app requires a minimum size to maintain core functionality. The best time to specify the minimum size is when the scene is about to connect. For example, you might specify a preferred minimum width of 500 points. This ensures that your app remains flexible and adaptable to different screen sizes. Make your UIKit app more flexible.
-
Scene Lifecycle: Adopting the UI Scene lifecycle is crucial for building flexible applications. This lifecycle allows each scene to independently save and restore its UI state, providing a strong foundation for flexibility. It's important to handle state restoration to ensure the UI state of a connecting scene is exactly how it was left before. Make your UIKit app more flexible.
-
Adaptivity: Ensure that your UI is adaptable by keeping content within the safe area and using layout guides to account for window controls. This helps in making sure that your UI is not occluded by system UI elements or device features. Make your UIKit app more flexible.
-
Mixing SwiftUI and UIKit: In iOS 26, you can mix SwiftUI and UIKit scene types in a single app, which enhances the flexibility and adaptability of your app. This allows you to leverage the strengths of both frameworks. Make your UIKit app more flexible.
These strategies are part of the broader effort to make UIKit apps more flexible and adaptable to various device configurations and user needs.

Make your UIKit app more flexible
Find out how your UIKit app can become more flexible on iPhone, iPad, Mac, and Apple Vision Pro by using scenes and container view controllers. Learn to unlock your app’s full potential by transitioning from an app-centric to a scene-based lifecycle, including enhanced window resizing and improved multitasking. Explore enhancements to UISplitViewController, such as interactive column resizing and first-class support for inspector columns. And make your views and controls more adaptive by adopting new layout APIs.

What’s new in UIKit
Modernize your app with the latest APIs in UIKit, including enhanced menu bar support, automatic observation tracking, a new UI update method, and improvements to animations. We’ll also cover how you can include SwiftUI scenes in your UIKit app and explore SF Symbols, HDR color pickers, and more.

Set the scene with SwiftUI in visionOS
Discover exciting new APIs to enhance windows, volumes, and immersive spaces in your visionOS app. Fine tune the behavior of your scenes when relaunched or locked in place. Make volumes adapt to their surroundings with clipping margins and snapping. Stream immersive content from Mac to Vision Pro. Elevate your existing UIKit-based apps with volumes and immersive spaces.