我有一个需要连接到外部显示器的应用程序,并且想要在两个屏幕上显示不同的内容(而不仅仅是镜像iPad屏幕)。
我尝试在我的
我还添加了一个开关,以返回每个屏幕的正确
在我
我尝试按照this tutorial的步骤进行操作,但自从iOS 13以来,
我真的不知道如何在不同的物理屏幕上显示不同的内容,有人能指点我一下吗?
我尝试在我的
Info.plist
中添加了一个场景配置:<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
<dict>
<key>UISceneConfigurationName</key>
<string>External Screen</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).ExtSceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Ext</string>
</dict>
</array>
</dict>
</dict>
我还添加了一个开关,以返回每个屏幕的正确
UISceneConfiguration
。func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
switch connectingSceneSession.role.rawValue {
case "UIWindowSceneSessionRoleApplication":
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
case "UIWindowSceneSessionRoleExternalDisplay":
return UISceneConfiguration(name: "External Screen", sessionRole: connectingSceneSession.role)
default:
fatalError("No such role, I think? \(connectingSceneSession.role.rawValue)")
}
}
在我
AppDelegate
中的configurationForConnecting
代码中设置的断点确实会在我连接外部屏幕时被调用,但我的应用程序仍然只是镜像显示iPad屏幕。我尝试按照this tutorial的步骤进行操作,但自从iOS 13以来,
screen
setter已经被弃用,因此该代码不起作用。我真的不知道如何在不同的物理屏幕上显示不同的内容,有人能指点我一下吗?