You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Xamarin中检测并禁用iPad的Stage Manager功能?

Xamarin中检测与禁用iPad Stage Manager(iOS 16测试版)

我正在进行一项POC(概念验证),尝试通过编程方式禁用iPad应用的Stage Manager功能,该功能属于iOS 16测试版内容。目前主要关注两个方向:

  • 检测Stage Manager是否已启用
  • 寻找禁用Stage Manager功能的方法

查阅大量资料后,我未找到Xamarin中可检测Stage Manager是否激活的官方API。我尝试了以下代码片段,但未得到正确结果:

var appWindow = application
            .ConnectedScenes
            .ToArray()
            .OfType<UIWindowScene>()
            .SelectMany(scene => scene.Windows)
            .FirstOrDefault(window => window.IsKeyWindow);

var screenHeight = appWindow.Window.WindowScene.Screen.Bounds.Height;
var windowHeight = appWindow.Window.Screen.Bounds.Height;
bool stageManager = screenHeight > windowHeight;                

上述代码片段参考自一篇文章中的Swift实现:

var isStageManager: Bool {
    guard UIDevice.current.userInterfaceIdiom == .pad,
       let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate,
       let screenHeight = sceneDelegate.window?.windowScene?.screen.bounds.height,
       let windowHeight = sceneDelegate.window?.bounds.height else { return false }
    return screenHeight > windowHeight
  }        

我尝试修改了screenHeight和windowHeight的获取方式,但即使Stage Manager已启用,两个变量的取值仍完全相同:

var screenHeight = appWindow.WindowScene.Screen.Bounds.Height;
var windowHeight = appWindow.Screen.Bounds.Height;

请问是否有人尝试过在Xamarin中实现该功能,或有相关参考思路能帮助推进解决方案?


内容的提问来源于stack exchange,提问作者Abishek Alva

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 16:35:26