如何在iOS上更改方向,如电影播放器或媒体播放器

如何在iOS上更改方向,如电影播放器或媒体播放器,ios,iphone,Ios,Iphone,在我的应用程序中,在纵向视图之后需要横向方向,或者在横向视图中使用与媒体播放器默认方向相同的方向。您必须覆盖shouldAutorotate: - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscape); } 这将强制您的控制器仅

在我的应用程序中,在纵向视图之后需要横向方向,或者在横向视图中使用与媒体播放器默认方向相同的方向。

您必须覆盖shouldAutorotate:

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscape);
}
这将强制您的控制器仅横向移动。

覆盖

   - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
方法,该方法位于包含电影播放器的viewController中