我以全屏模式啓動MPMoviePlayerController,然後用默認按鈕關閉它。 ?它的工作原理就像一個的iOS4.3魅力,但葉iOS5.0 :(黑屏MPMoviePlayerController不在iOS5.0上關閉
難道我做錯了什麼,這裏是我的代碼:
展現給玩家:
- (void)showVideo {
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theURL];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
moviePlayer.shouldAutoplay = YES;
moviePlayer.view.frame = [[UIScreen mainScreen] applicationFrame];
moviePlayer.view.transform = CGAffineTransformMakeRotation(1.57079633);
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:NO];
}
要關閉播放器:
- (void) moviePlayBackDidFinish : (NSNotification *) notification
{
MPMoviePlayerController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[moviePlayer.view removeFromSuperview];
[moviePlayer stop];
[moviePlayer release];
//otherwise the status bar hides or changes color from time to time
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}
它後面的項目似乎是繪圖(有些項目可以看到片刻,而旋轉) – Daniel
我想這將是最好的解決方案:(我不相信蘋果的SDK通過QA ..他們是否有質量保證部門? – Daniel
如果我找到更好的解決方案,我會添加它。但atm我忙於做無聊的數據庫狗屎。 – SpittingLlama