我正在使用 AVPlayerViewController 并且无法显示 Done 按钮,也无法关闭播放器。也许你可以帮助我。这是我在 objective-c 中的代码
UIView *view = self.view;
NSURL *fileURL = [NSURL URLWithString: _detailData[0]];
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
playerViewController.player = [AVPlayer playerWithURL:fileURL];
self.avPlayerViewcontroller = playerViewController;
[self resizePlayerToViewSize];
[self dismissViewControllerAnimated:YES completion:nil];
[view addSubview:playerViewController.view];
[playerViewController.player play];
view.autoresizesSubviews = TRUE;
需要帮助的人,非常感谢。
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self
actionselector(aMethod
forControlEvents:UIControlEventTouchUpInside];
[button setTitle"Done" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); // set your own position
[view addSubview:button]; // or you can add [playerViewController.view addSubview:button];
-(void)aMethodUIButton *)button {
// Remove playerViewController.view
}
关于ios - 如何在 AVPlayerViewController 中添加完成按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36175842/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |