How to make iPad app move to display show full-screen and center align

I wrote an app that can show live streaming. When using iPad, I can connect an external display and move app to display, that I can do what I want on my iPad and watch live streaming on external display using cable.

But app moving to display is not always full screen, and on some displays it shows larger than the external display range that I should go to Settings -> Display & Brightness -> External Display -> Switching "Allow Display Mode Changes" to fix this issue.

Are there APIs to make the App "move to display" programmatically, keep app full-screen, matching the external display's resolution on the External display?

Answered by Frameworks Engineer in 803634022

Are there APIs to make the App "move to display" programmatically

There are no APIs to move your interactive windowApplication roles scenes to the external display programmatically.

There are situations, though, where your application will be offered a windowExternalDisplayNonInteractive role scene, such as when your application is the primary app on the embedded display. If you place content in that scene by creating a UIWindow there, your content will be full screen on the external display.

Note that this is a non-interactive scene so you cannot move the system pointer to that scene or have content in that scene receive keyboard input. That can work fine for some situations, like a game party mode, but we usually recommend folks start with a normal windowApplication role scene as that provides more options to users.

For more information on windowExternalDisplayNonInteractive role scenes, see this article: https://developer.apple.com/documentation/uikit/windows_and_screens/presenting_content_on_a_connected_display

matching the external display's resolution on the External display?

The same article provides some detail on setting the mode of the UIScreen (which you can get from either your UIWindow or UIWindowScene instances): https://developer.apple.com/documentation/uikit/windows_and_screens/presenting_content_on_a_connected_display#4030186

Are there APIs to make the App "move to display" programmatically

There are no APIs to move your interactive windowApplication roles scenes to the external display programmatically.

There are situations, though, where your application will be offered a windowExternalDisplayNonInteractive role scene, such as when your application is the primary app on the embedded display. If you place content in that scene by creating a UIWindow there, your content will be full screen on the external display.

Note that this is a non-interactive scene so you cannot move the system pointer to that scene or have content in that scene receive keyboard input. That can work fine for some situations, like a game party mode, but we usually recommend folks start with a normal windowApplication role scene as that provides more options to users.

For more information on windowExternalDisplayNonInteractive role scenes, see this article: https://developer.apple.com/documentation/uikit/windows_and_screens/presenting_content_on_a_connected_display

matching the external display's resolution on the External display?

The same article provides some detail on setting the mode of the UIScreen (which you can get from either your UIWindow or UIWindowScene instances): https://developer.apple.com/documentation/uikit/windows_and_screens/presenting_content_on_a_connected_display#4030186

Thank you very much for your response. My use case involves using other applications on the iPad while having my app displayed on an external monitor. Based on the documentation you provided, I understand that the recommended Role for a UIScene on an external display is windowExternalDisplayNonInteractive. However, my requirement is to move the main application to the external display. The documentation advises against changing the windowApplication role. Could you explain the considerations behind this recommendation?

I'm considering whether it would be feasible to change the role to windowExternalDisplayNonInteractive when moving the app to the external display, and then change it back to windowApplication when returning to the iPad. Is this approach viable? Or do you have any other suggestions for achieving this requirement?

How to make iPad app move to display show full-screen and center align
 
 
Q