【发布时间】:2017-03-24 19:12:24
【问题描述】:
我正在尝试仅将一个视图控制器锁定为纵向,同时允许所有其他视图为任意方向。这就是我试图放入我的 homeViewController 的内容(我想保持纵向的那个)。
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.Portrait;
}
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
{
return UIInterfaceOrientation.Portrait;
}
public override bool ShouldAutorotate()
{
return false;
}
我正在尝试在 c# 中的 xamarin 中执行此操作。有人有什么建议吗?
【问题讨论】:
-
您的代码适合
UIViewController,即PresentViewControllering 另一个UIViewController....但是您使用的是UINavigationController吗?和/或您的homeViewController是第一个在应用启动时显示的 VC(?)并且必须是纵向的并且之后的所有 VC 都已解锁? -
是的,我正在使用 UINavigationController。 homeViewController 是第一个加载的。我只想将视图锁定为纵向,其余视图锁定在任何方向。
标签: c# ios xamarin uiviewcontroller appdelegate