Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios MPMoviePlayerViewController将UIView移到状态栏后面_Ios_Xcode_Statusbar - Fatal编程技术网

Ios MPMoviePlayerViewController将UIView移到状态栏后面

Ios MPMoviePlayerViewController将UIView移到状态栏后面,ios,xcode,statusbar,Ios,Xcode,Statusbar,在iOS 7上使用MPMoviePlayerViewController多次播放电影后,整个屏幕移到状态栏后面。我已经通过在应用程序委托中添加以下代码说明了iOS 7在应用程序启动时使用全屏所做的更改 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { [application setStatusBarStyle:UIStatusBarStyleLightContent]; [applicati

在iOS 7上使用MPMoviePlayerViewController多次播放电影后,整个屏幕移到状态栏后面。我已经通过在应用程序委托中添加以下代码说明了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];
}
当演示屏幕返回时,它会上移到状态栏后面

尚未奏效的解决方案包括:

  • 在[self]之后的应用程序委托中添加相同的逻辑 解雇电影…]。但是self.view.window为零,因为 屏幕上还没有显示视图。甚至把它重新安置在 当self.view.window不是nil时,视图将出现,不工作
  • 尝试更新[[[UIApplication sharedApplication]委托] [self dismissMovie…]之后的窗口]也不能完全工作。这个 窗口和状态栏显示正确,但视图显示不正确。 尝试更改viewDidAppear中的帧未成功
  • 这篇来自苹果的文章没有帮助,因为在添加了所有缺少的内容之后 限制条件下,屏幕上的所有图像都是倾斜的,因此 转移人们对原始问题的注意力。
  • 在发布之前,努力纠正屏幕移动 2014年1月的文章没有在iOS 7上运行
  • 使用推送序列到另一个视图控制器,然后将其放回到显示 视图也不起作用。它仍然在向上移动
  • 非常感谢您的评论、建议、建议和/或解释