Tôi đã đấu tranh với một vấn đề rất khó chịu cả ngày và tôi hy vọng tôi có thể tìm sự giúp đỡ trên bảng này.Ẩn Statusbar khỏi MPMoviePlayerController
Tôi đang sử dụng MPMoviePlayerController để phát phim toàn màn hình trên iPad và tôi không thể tìm cách xóa thanh trạng thái luôn hiển thị bất chấp mọi nỗ lực của tôi để biến nó thành địa ngục.
Đây là mã của phương pháp tôi sử dụng để hiển thị các bộ phim:
-(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);
}
Trong giao diện điều khiển, tôi có thể thấy rằng moviePlayerEvent được kích hoạt khi bộ phim xuất hiện nhưng statusbar vẫn còn đó: [[UIApplication sharedApplication] setStatusBarHidden: YES withAnimation: NO] dường như không hoạt động. Tôi đã cố gắng sử dụng các thông báo MPMoviePlayerController khác mà không có may mắn.
Có ai có thể giúp tôi về điều đó không?
Xin cảm ơn trước.
+1 để có câu trả lời đúng. Vui lòng gửi báo cáo lỗi về vấn đề này. – Till
Thật ngu ngốc, tôi có một thanh trạng thái trống và tôi không thể loại bỏ nó. – EladG