无法正确实现 UIInputViewAudioFeedback
我正在尝试实现 UIInputViewAudioFeedback 协议。 我创建了 UIView 的自定义子类。头文件包含协议,m文件实现方法enableInputClicksWhenVisible。 然后,在 Interface Builder 中,我将视图的类设置为我的自定义类。然后,我进入了通过点击视图上的 UIButtons 触发的方法并执行 [[UIDevice currentDevice] playInputClick];
我的 iPhone 上的键盘点击功能已打开,但当我点击按钮时,它们不会发出声音。
我做错了什么? 谢谢
I am trying to implement the UIInputViewAudioFeedback protocol.
I have created a custom subclass of UIView. The header file contains the protocol and the m file implements the method enableInputClicksWhenVisible.
In Interface Builder I then set the View's Class to my Custom Class. I then went into the methods that get triggered by tapping UIButtons that are on the view and execute [[UIDevice currentDevice] playInputClick];
I have keyboard clicks on my iPhone turned on, but when I tap the buttons they just won't make a sound.
What am I doing wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我唯一能想到的是你试图在任意视图上实现这个协议。播放输入点击声音仅适用于用作系统键盘替代品的自定义视图。
来自 iOS 开发人员库文档 UIInputViewAudioFeedback 协议参考< /a>:
要实现自定义键盘,请参阅自定义视图数据输入。
The only thing I can think of is that you're trying to implement this protocol on an arbitrary view. Playing the input clicking sound is only available to custom views that are used as replacements for the system keyboard.
From the iOS Developer Library document UIInputViewAudioFeedback Protocol Reference:
To implement a custom keyboard, see Custom Views for Data Input.