2010-05-26 60 views

回答

0

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

你的处理器看起来类似的东西:

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

这不起作用,请参阅:http://stackoverflow.com/questions/3653236/hide-statusbar-from-mpmovieplayercontroller – Stas 2013-02-26 13:36:42

+0

我试着几种不同的方法,这是为我工作的。 – 2016-06-27 12:44:21

0
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; 
相关问题