作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我无法解决这个问题 - 它应该很简单。
我有:
显示播放器方法
AVPlayerItem *video = [[AVPlayerItem alloc] initWithURL:url];
AVQueuePlayer *queue = [[AVQueuePlayer alloc] initWithItems:@[video]];
video = [[AVPlayerItem alloc] initWithURL:url];
[queue insertItem:video afterItem:nil];
AVPlayer *player = [AVPlayer playerWithURL:url];
self.avmovieplayer = [AVPlayerViewController new];
我想在叠加层上添加一个按钮 - 但该按钮没有响应:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"Do stuff" forState:UIControlStateNormal];
btn.frame = CGRectMake(0, 330, 320, 40);
[btn addTarget:self action:@selector(DoSpeech:) forControlEvents:UIControlEventTouchUpInside];
[btn setUserInteractionEnabled:true];
[self.avmovieplayer.contentOverlayView addSubview:btn];
这是我的 DoSpeech
,它永远不会被调用:
- (void) DoSpeech:(UIButton *)button {
//DoSpeech
}
最佳答案
试试这个,
[btn setUserInteractionEnabled:YES];
[self.avmovieplayer.contentOverlayView bringSubviewToFront:btn];
希望对您有所帮助。
关于ios - contentOverlayView 上的按钮没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36570232/
我无法解决这个问题 - 它应该很简单。 我有: 显示播放器方法 AVPlayerItem *video = [[AVPlayerItem alloc] initWithURL:url]; AVQueu
我需要向 AVPlayerViewController 添加一个自定义按钮,该按钮将出现在运行 iOS 8 的应用程序的全屏和非全屏中。 将按钮添加到 AVPlayerViewController.v
我正在尝试使用 contentOverlayView 向 AVPlayerViewController 添加一个额外的按钮。问题是我只想在播放器控件显示时显示按钮。我觉得在这个阶段这是不可能的,但想确
我有以下 tvOS 应用程序的代码。它按照我想要的方式播放视频,但是我设置的 contentOverlayView 没有出现。从我看过的例子来看,我认为它应该有效。有人可以解释一下我做错了什么吗? i
我正在尝试添加一个 UISlider 来控制 AVPlayerViewController 中的音量,为此我在“AVPlayerViewController.contentOverlayView”上添
我是一名优秀的程序员,十分优秀!