OGeek|极客世界-中国程序员成长平台

标题: ios - MPVolumeView AirPlay 按钮未显示 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:03
标题: ios - MPVolumeView AirPlay 按钮未显示

我正在尝试将 MPVolumeView 的播放按钮放置在 UIBarButtonItem 的 View 中,但该按钮不会显示。我正在调试 View 的层次结构(如下图所示),它清楚地表明它在那里,甚至在层次结构的顶部,但它不会显示在设备中。

View Hierarchy

enter image description here



Best Answer-推荐答案


管理 Airplay 按钮非常令人沮丧,因为您必须处理操作系统采取的操作。根据我的经验,假设 MpVolumeView 按钮正确放置在您的 View Controller 中,您必须检查 MpVolumeView 中 MpButton 的 Alpha 值。

如您所知,MpVolumeView 由三个不同的 subview 组成:

您必须查看 MPVolumeView 的 subview 内部并检查 MPButton(路由按钮)的 alpha,因为该值可能已被操作系统更改,因此您无法在屏幕(记住:Alpha = 0 View 不可见,Alpha = 1 View 可见)。

关于ios - MPVolumeView AirPlay 按钮未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42417551/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4