iPhone SDK - 如果按下硬件按钮,如何禁用音量指示器视图? [英] iPhone SDK - How to disable the volume indicator view if the hardware buttons are pressed?

查看:146
本文介绍了iPhone SDK - 如果按下硬件按钮,如何禁用音量指示器视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法阻止音量指示器视图表单显示你是否按下音量增大/减小硬件按钮?

Is there a way to prevent the volume indicator view form showing if you press the volume up/down hardware buttons?

仅限演示应用程序需要它。因此该方法不需要App Store安全。

It's needed for a demo app only. So the method don't need to be App Store safe.

推荐答案

IIRC,MPVolumeView的存在会禁止显示音量指示符叠加。尝试坚持相关视图并查看是否是这种情况。

IIRC, the presence of a MPVolumeView inhibits the display of the volume indicator overlay. Try sticking it the relevant view and seeing if this is the case.

然后你可以尝试各种技巧使其有效隐形:

Then you can try various tricks to make it effectively invisible:


  • 隐藏(或隐藏超级视图)。

  • 将其alpha(或superview的alpha)设置为0,或者0.01左右。

  • 将其移出屏幕

  • 几乎将其移出屏幕(例如,屏幕上只有左上角的像素) )

  • 将其粘贴在另一个视图下。

  • 将其粘贴在子视图中,其中clipsToBounds = ON,并将其移到这些边界之外

  • 将volumeView.layer.mask设置为新的(因此完全透明的)CALayer。设置volumeView.userInteractionEnabled = NO。

  • Make it hidden (or make a superview hidden).
  • Set its alpha (or the alpha of a superview) to 0, or 0.01, or so.
  • Move it off-screen
  • Move it almost off-screen (e.g. so only the top-left pixel is on screen)
  • Stick it under another view.
  • Stick it in a subview with clipsToBounds=ON, and move it outside those bounds
  • Set volumeView.layer.mask to a new (thus fully-transparent) CALayer. Set volumeView.userInteractionEnabled = NO.

MPVolumeView理论上可以检测到所有这些,但我怀疑它们中的一些会起作用。

All of these are theoretically detectable by MPVolumeView, but I suspect some of them will work.

这篇关于iPhone SDK - 如果按下硬件按钮,如何禁用音量指示器视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆