【发布时间】:2016-03-08 09:38:11
【问题描述】:
我正在尝试通过 Airplay 连接 Apple tv,但如果我连接任何其他外部设备(如蓝牙)或其他设备,它显示为窗口中连接的设备,则问题是有一段时间了。所以我想确定连接了哪个设备,只有在连接 Apple tv 时才需要启用。
我如何识别它是 Apple tv 还是其他设备?
这就是我创建 Airplay 自定义按钮的方式
for (UIButton *button in volumeView.subviews) {
if ([button isKindOfClass:[UIButton class]]) {
self.airplayButton = (UIButton*)button;
button.frame = CGRectMake(0, 0, 30, 23);
button.backgroundColor = [UIColor clearColor];
[self.airplayButton addObserver:self forKeyPath:@"alpha" options:NSKeyValueObservingOptionNew context:nil];
}
}
因此,即使连接了其他一些设备,按钮的 alpha 值也总是会发生变化。
【问题讨论】:
标签: ios xcode airplay apple-tv