Ios 如何以编程方式将UIViewController的方向更改为横向?

Ios 如何以编程方式将UIViewController的方向更改为横向?,ios,orientation,landscape,Ios,Orientation,Landscape,我想更改使用presentModalViewController显示的UIViewController的方向。。。我在网上看到了一些解决方案(包括SO)。然而,他们都没有解决我的问题 我正在这里播放一些视频,希望将屏幕方向更改为横向。。有什么帮助吗 谢谢 使用这段代码,我部分地解决了我的问题:(我的视图控制器只为LandscapeLEFT而不是LandscapeRIGHT执行横向==>对于LandscapeRIGHT,它仍然在视图控制器中执行LandscapeLEFT方向更改)。。。有什么帮助吗

我想更改使用
presentModalViewController
显示的UIViewController的方向。。。我在网上看到了一些解决方案(包括SO)。然而,他们都没有解决我的问题

我正在这里播放一些视频,希望将屏幕方向更改为横向。。有什么帮助吗

谢谢

使用这段代码,我部分地解决了我的问题:(我的视图控制器只为LandscapeLEFT而不是LandscapeRIGHT执行横向==>对于LandscapeRIGHT,它仍然在视图控制器中执行LandscapeLEFT方向更改)。。。有什么帮助吗

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
试试这个: 返回[是]将确保应用程序中支持所有界面操作

  • (布尔)应自动旋转指针面定向:(UIInterfaceOrientation interfaceOrientation{ //对于支持的方向返回YES 返回YES; }
试试这个: 返回[是]将确保应用程序中支持所有界面操作

  • (布尔)应自动旋转指针面定向:(UIInterfaceOrientation interfaceOrientation{ //对于支持的方向返回YES 返回YES; }

您想强制旋转还是允许旋转?您想强制旋转还是允许旋转?我目前正在使用:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{//如果([[UIDevice currentDevice]userInterfaceIdiom]则返回支持方向的YES==UIUserInterfaceIdiomPhone){return(interfaceOrientation!=UIInterfaceOrientationGraphitoUpsideDown | | interfaceOrientation!=UIInterfaceOrientationGraphitographic);}否则{return YES;}
但没有帮助:(我目前正在使用这个:
-(BOOL)应该自动旋转指针方向:(UIInterfaceOrientation)interfaceOrientation{//如果([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdioPhone){返回(interfaceOrientation!=UIInterfaceOrientationGraphitoUpsideDown | | interfaceOrientation!=UIInterfaceOrientationGraphito);}则返回支持方向的YES}否则{返回YES;}
但没有帮助:(