Iphone 纵向视频列表;景观中的视频播放

Iphone 纵向视频列表;景观中的视频播放,iphone,ios5,mpmovieplayercontroller,Iphone,Ios5,Mpmovieplayercontroller,我有一个视频列表,用户可以从中选择观看。所有视频都包含在应用程序资源中,并在本地播放 除了一件事,我的一切都很好。我不知道如何强制视频播放到横向模式 我正在使用此代码在选择视频时显示视频播放器: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { VideoPlayerViewController *detailViewController = [[Vi

我有一个视频列表,用户可以从中选择观看。所有视频都包含在应用程序资源中,并在本地播放

除了一件事,我的一切都很好。我不知道如何强制视频播放到横向模式

我正在使用此代码在选择视频时显示视频播放器:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    VideoPlayerViewController *detailViewController = [[VideoPlayerViewController alloc] init];
    detailViewController.delegate = self;

    detailViewController.contentPath = [[videos objectAtIndex:indexPath.row] objectAtIndex:1];

    [self presentModalViewController:detailViewController animated:YES];
}
我的播放器类VideoPlayerViewController使用上述代码中设置的contentPath加载播放器并播放视频

我可以旋转手机,它会切换到横向,但如果我将手机旋转回纵向,视频也会旋转。我的播放器具有以下代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
你知道为什么它允许旋转回到纵向,以及我如何开始在横向播放吗

我正在寻找与原生YouTube应用程序类似的功能


谢谢

在VideoPlayerServiceController viewDidLoad方法和shouldautorotate方法中使用此选项:

 [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

 [[self view] setBounds:CGRectMake(0, 0, 480, 320)];
 [[self view] setCenter:CGPointMake(160, 240)];
 [[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];

这是一个很棒的保险箱。它工作得很好。非常感谢你。