我不明白如何在我的肖像应用程序中强制使用我的视频播放器。
在我的AppDelegate中,我有这个:
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
return UIInterfaceOrientationMask.AllButUpsideDown;
}
在我的演示ViewController中,我有这个:
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.Portrait;
}
public override bool ShouldAutorotate()
{
return false;
}
在我的VideoViewController中我有这个:
public override UIInterfaceOrientation PreferredInterfaceOrientationForPresentation()
{
return UIInterfaceOrientation.LandscapeLeft;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
return UIInterfaceOrientationMask.Landscape;
}
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
{
return toInterfaceOrientation == UIInterfaceOrientation.LandscapeLeft || toInterfaceOrientation == UIInterfaceOrientation.LandscapeRight;
}
public override bool ShouldAutorotate()
{
return true;
}
正如您所看到的,我试图覆盖每个现有方法。我完全没有想法。我做错了什么?
编辑:我在日志中发现了一条警告:Presenting view controllers on detached view controllers is discouraged
,但我正在正确设置rootViewController
,我正在使用子视图控制器,而我是不在viewDidAppear
之前展示视频。这与我的问题有关吗?