He estado luchando con un problema muy molesto todo el día y espero poder encontrar ayuda en este foro.Ocultar StatusBar de MPMoviePlayerController
Estoy usando un MPMoviePlayerController para reproducir una película a pantalla completa en iPad y no sé cómo quitar la barra de estado que siempre se muestra a pesar de todos mis esfuerzos para hacer que se vaya al infierno.
Este es el código del método que utilizo para visualizar la película:
-(void)launchVideoFromButton:(id)sender{
NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"movie01" ofType:@"m4v"];
NSURL *videoPathURL = [NSURL fileURLWithPath:videoPath];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoPathURL];
[self.view addSubview:moviePlayer.view];
moviePlayer.shouldAutoplay = YES;
moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[moviePlayer setFullscreen:YES animated:YES];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(moviePlayerEvent:) name:MPMoviePlayerLoadStateDidChangeNotification object:moviePlayer];
}
-(void)moviePlayerEvent:(NSNotification*)aNotification{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
NSLog(@"%i", [UIApplication sharedApplication].statusBarHidden);
}
En la consola, puedo ver que moviePlayerEvent se dispara cuando aparezca la película, pero la barra de estado sigue ahí: [[UIApplication sharedApplication] setStatusBarHidden: YES withAnimation: NO] parece estar inoperante. He intentado usar las otras notificaciones de MPMoviePlayerController sin suerte.
¿Alguien podría ayudarme en eso?
Gracias de antemano.
+1 para la respuesta correcta. Por favor presente un informe de error sobre este problema. – Till
Tan estúpido, tengo una barra de estado vacía y no me puedo deshacer de ella. – EladG