C# 从纵向视图控制器显示横向视频

C# 从纵向视图控制器显示横向视频,c#,ios,xamarin,screen-rotation,C#,Ios,Xamarin,Screen Rotation,我不明白如何在我的肖像应用程序中强制我的视频播放器进入风景区 在我的AppDelegate中,我有以下内容: public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow) { return UIInterfaceOrientationMask.AllButUpsideDown; } public ove

我不明白如何在我的肖像应用程序中强制我的视频播放器进入风景区

在我的AppDelegate中,我有以下内容:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
    return UIInterfaceOrientationMask.AllButUpsideDown;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
    return UIInterfaceOrientationMask.Portrait;
}

public override bool ShouldAutorotate()
{
    return false;
}
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;
}
在我的演示视图控制器中,我有:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
    return UIInterfaceOrientationMask.AllButUpsideDown;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
    return UIInterfaceOrientationMask.Portrait;
}

public override bool ShouldAutorotate()
{
    return false;
}
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;
}
在我的VideoViewController中,我有:

public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
{
    return UIInterfaceOrientationMask.AllButUpsideDown;
}
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
{
    return UIInterfaceOrientationMask.Portrait;
}

public override bool ShouldAutorotate()
{
    return false;
}
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;
}
如您所见,我已尝试覆盖每个现有方法。我完全没有主意了。我做错了什么


编辑:我注意到日志中有一条警告:
不建议在分离的视图控制器上显示视图控制器
,但我正在正确设置
根视图控制器
,我正在正确使用子视图控制器,并且在
视图出现之前我没有显示视频。这与我的问题有关吗?

你是否尝试过你的ShouldAutorotateToInterfaceOrientation-return to interfaceOrientation==UIInterfaceOrientation.LandscapeLeft | | UIInterfaceOrientation.LandscapeRight?@PavelGatilov:正如你所见,我允许所有旋转,但什么都没有发生。。。或者你的意思是在演示的viewcontroller中?在你的VideoViewController中,不要只为ShouldAutorotateToInterfaceOrientation返回true,而尝试仅为横向左或右方向返回true。@Pavelgatiov我这样做了,它甚至没有被调用。你试过你的ShouldAutorotateToInterfaceOrientation-return to interfaceOrientation==UIInterfaceOrientation.LandscapeLeft | | UIInterfaceOrientation.LandscapeRight?@PavelGatilov:正如你所见,我允许所有旋转,但什么都没有发生。。。或者你的意思是在演示viewcontroller中?在你的VideoViewController中,不要只为ShouldAutorotateToInterfaceOrientation返回true,而尝试仅为横向左或右方向返回true。@PavelGatilov我这样做了,它甚至没有被调用。