【问题标题】:Hide the status while playing movie using MPMoviePlayerController使用 MPMoviePlayerController 播放电影时隐藏状态
【发布时间】:2010-05-26 05:06:40
【问题描述】:

我已经使用[[UIApplication sharedApplication] setStatusBarHidden:YES]; 在我的应用程序中隐藏了状态栏。但是当我播放电影时,它会自动在顶部显示状态栏。

有谁知道如何在播放电影时隐藏状态栏。

【问题讨论】:

    标签: iphone


    【解决方案1】:

    您可以订阅MPMoviePlayerPlaybackStateDidChangeNotification 通知,并确保播放开始后状态栏是隐藏的。

    你的处理程序看起来像这样:

    - (void)playbackStateDidChange:(NSNotification *)notification {
        MPMoviePlayerController *mpv = (MPMoviePlayerController *)notification.object;
        if (mpv.playbackState == MPMoviePlaybackStatePlaying) {
            [[UIApplication sharedApplication] setStatusBarHidden:YES];
        }
    }
    

    【讨论】:

    【解决方案2】:
    MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];
        [AppShare.viewController presentMoviePlayerViewControllerAnimated:playercontroller];
        //[self.view addSubview: playercontroller.view];
        [self.view addSubview:playercontroller.view];
        playercontroller.moviePlayer.view.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
        playercontroller.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
        playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
        playercontroller.moviePlayer.controlStyle = MPMovieControlStyleNone;
        [playercontroller.moviePlayer prepareToPlay];
        [playercontroller.moviePlayer play];
        playercontroller = nil;
    

    【讨论】:

      猜你喜欢
      • 2011-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-08
      • 1970-01-01
      • 2011-03-13
      • 1970-01-01
      相关资源
      最近更新 更多