UINavigationController 隐藏 AVPlayerViewController 进度滑块

UINavigationController hides AVPlayerViewController progress slider

我将 AVPlayerViewController 与 UINavigationController 一起使用,如下面的代码。

AVPlayerViewController* audioPlayer = [[AVPlayerViewController alloc] init];
audioPlayer.audioFilePath = recordFilePath;
[self.navigationController pushViewController:audioPlayer animated:YES];

当AVPlayerViewController出现时,进度条已经被UINavigationBar控件隐藏了

如何将进度滑块与 UINavigationBar 一起显示?

尝试在viewDidLoad

中将导航栏的半透明属性设置为"NO"

self.navigationController.navigationBar.translucent = NO;

它将从导航栏和状态栏下方的框架开始视图。因此你可以看到 AVPlayerViewController 进度滑块。

- (void)viewDidLoad    
{       
    [super viewDidLoad];

    self.navigationController.navigationBar.translucent = NO;
    [self performSelector:@selector(PlayVideo) withObject:self afterDelay:1.0];
}

-(void)PlayVideo    
{         
    NSURL *videoURL = [NSURL URLWithString:@"https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"];

    AVPlayer *player = [AVPlayer playerWithURL:videoURL];    
    AVPlayerViewController *playerViewController = [AVPlayerViewController new];
    playerViewController.player = player;

    [self.navigationController pushViewController:playerViewController animated:YES];
}

The progress slider will shown at the bottom of the device