Ios 不推荐使用MPVolumeView中的ShowsRoute按钮
自iOS 13以来,MPVolumeView中的showsRouteButton已被弃用Ios 不推荐使用MPVolumeView中的ShowsRoute按钮,ios,deprecated,mpvolumeview,Ios,Deprecated,Mpvolumeview,自iOS 13以来,MPVolumeView中的showsRouteButton已被弃用 let vv = MPVolumeView() vv.showsRouteButton = false 警告是: 'showsRouteButton' was deprecated in iOS 13.0: Use AVRoutePickerView instead. 苹果告诉我使用AVRoutePickerView进行路由,这毫无意义,因为在我的情况下,我不想使用任何路由内容,我只想隐藏它。 看来再也
let vv = MPVolumeView()
vv.showsRouteButton = false
警告是:
'showsRouteButton' was deprecated in iOS 13.0: Use AVRoutePickerView instead.
苹果告诉我使用AVRoutePickerView进行路由,这毫无意义,因为在我的情况下,我不想使用任何路由内容,我只想隐藏它。
看来再也没有不推荐的方法了
如果它被弃用,它应该在默认情况下隐藏,否则苹果应该允许我们隐藏它
我说这是apple API错误,对吗?现在只是为了删除警告和默认路由按钮,我在初始化
MPVolumeView
后立即使用了它
我通过键值路径检查
showsRouteButton
的值是否为true
,如果为false
,则将其设置为false。您有什么收获吗?我也有同样的问题,没有办法用苹果控件来处理这个问题
if volumeView.value(forKey: #keyPath(MPVolumeView.showsRouteButton)) as? Bool == true {
volumeView.setValue(false, forKey: #keyPath(MPVolumeView.showsRouteButton))
}