iOS 版 Drum Sim 构建示例
我正在尝试在 Xcode 中为我姐夫乐队的应用程序构建一个鼓模拟器。我在做这件事时遇到了一点麻烦。我想做的是使用鼓手鼓组的图片,并将其用作可以在 iPhone 上演奏的鼓。我想它可能有点像 HTML 中的图像映射,其中按钮会播放鼓声和其他声音。如果有人对此有任何想法或操作方法,我们将不胜感激。 谢谢
I'm trying to build a drum simulator in Xcode for an app for my brother in laws band. I'm having a little trouble doing this. What I'm wanting to do is use a picture of the drummer's drum set and use that as the drum you can play on the iPhone. I was thinking it could kind of be like an image map in HTML where the buttons would play a sound of the drum and everything else. If anyone has any ideas or how-tos on this it would be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个非常基本的方法:
使用
UIImageView
以鼓组图像作为背景。在每个鼓前面创建一个透明的 UIView。附加一个
UITapGestureRecognizer
到每个 UIView。该手势识别器应该为每个视图调用不同的方法。使用AVAudioPlayer
< /a> 播放声音。这只是一个非常基本的应用程序,但还不错。完成此操作后,您的下一个任务可能是:
A very basic approach:
Use a
UIImageView
with an image of the drumkit as background.Create a transparent UIView in front of each drum. Attach a
UITapGestureRecognizer
to each UIView. This gesture recognizer should call a different method for each view. UseAVAudioPlayer
to play the sound.That's just a very basic app but not so bad. After you've done with that your next tasks could be:
如果 UIImageView 的皮肤上有一些漂亮的隐形按钮(UIButton 的tintColor 属性,如
button.tintColor = [UIColorclearColor];
),那就太完美了。然后,看看如何在这里播放一些音频: http ://blogs.x2line.com/al/archive/2011/05/19/3831.aspxA UIImageView with some nice invisible buttons (UIButton's tintColor property as in
button.tintColor = [UIColor clearColor];
) over the skins would be perfect. Then, take a look at how to play some audio over here: http://blogs.x2line.com/al/archive/2011/05/19/3831.aspx