Xamarin: GetSupportedInterfaceOrientations missing in iOS 8?

本文关键字:iOS in missing GetSupportedInterfaceOrientations Xamarin | 更新日期: 2023-09-27 18:21:39

    public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations ()
    {
        return UIInterfaceOrientationMask.All;
    }

当我尝试在适用于iOS 8的Xamarin中编译它(iOS 7中的工作代码(时,它错误地说GetSupportedInterfaceOrientations((不是一种方法

Xamarin: GetSupportedInterfaceOrientations missing in iOS 8?

这是 8.0 beta 版本中的一项重大更改(我们正在研究修复它(,会影响UISplitViewController

解决方法是使用较新的、基于 *Delegate 的属性,该属性是引入的(并破坏了override(,如下所示:

using (UISplitViewController svc = new UISplitViewController ()) {
    svc.GetSupportedInterfaceOrientations = (UISplitViewController) => UIInterfaceOrientationMask.All;
}

注意:XI 8.0的下一个测试版(也是最终版(已修复,覆盖将正常工作。