使用MPMoviePlayerViewController在iOS 7上多次播放电影后,整个屏幕会在状态栏后面移动。我已经考虑了iOS 7在应用程序启动时通过在应用程序委托中添加以下代码来使用全屏幕所做的更改
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
[application setStatusBarStyle:UIStatusBarStyleLightContent];
[application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
self.window.clipsToBounds =YES;
self.window.frame =CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
}
完美地显示初始屏幕。但是,在该屏幕上是一个播放视频并按以下方法退出的按钮
- (void)playFullScreenMovie
{
NSURL *url = [NSURL URLWithString:vidURL];
self.playerVC = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
// Register this class as an observer
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:self.playerVC.moviePlayer];
[[self playerVC].moviePlayer prepareToPlay];
[self presentViewController:self.playerVC animated:NO completion:nil];
}
// When the movie is done, release the controller.
-(void)movieFinishedCallback: (NSNotification*) aNotification
{
MPMoviePlayerController* theMovie = [aNotification object];
[[NSNotificationCenter defaultCenter]
removeObserver: self
name: MPMoviePlayerPlaybackDidFinishNotification
object: theMovie];
[self dismissMoviePlayerViewControllerAnimated];
}
当呈现屏幕返回时,它会向上移动,位于状态栏后面。
尚未奏效的解决方案包括:
非常感谢您的意见,建议,建议和/或解释。