【发布时间】:2011-02-15 13:59:38
【问题描述】:
我想在应用程序启动时以横向模式显示 MPMoviePlayer。现在它以纵向模式启动。有一些代码会强制应用程序以横向模式启动。但是据说这些代码段属于私有api,所以应用商店不接受申请。从早上开始,我就在想办法,但没有结果……有人能帮帮我吗?
这就是我所在的地方:
NSURL *url = [[NSURL alloc] initWithString:urlString];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(videoPlayerPlaybackStateChanged:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:nil];
[self setWantsFullScreenLayout:YES];
[moviePlayer prepareToPlay];
//For viewing partially.....
moviePlayer.view.backgroundColor = [UIColor blackColor];
//[moviePlayer.view setFrame:CGRectMake(0, 0, 320, 410)];
[moviePlayer.view setFrame:[self.view bounds]];
moviePlayer.fullscreen = YES;
moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
[self.view addSubview:moviePlayer.view];
//[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
[moviePlayer play];
提前致谢..
【问题讨论】:
-
你找到解决办法了吗?
标签: iphone mpmovieplayercontroller landscape