Ipad piano-like app help!
I am writing an iPad piano-like app. I firstly created the keys by UIButton, everything worked fine but when I want to slide from one key to another I found that it's a drag-out action (of the first button) rather than touch d开发者_开发技巧own action (of the second button) so Just wondering does anyone know any ways to disable the dragging of UIbutton or any other better way to do that sliding ?
Very old question, but as I'm working on this now... When I started implementing a piano keyboard, I simply used a big image of the keyboard, and worked out what key was being pressed in my controllers touchesBegan
, touchesMoved
methods. Then, when I wanted to add key press effects, I thought UIButton
s would work well. Unfortunately, I ran into the same problem you have: the first UIButton
key pressed "captures" the touch, which is then not available to the other keys.
The simplest solution, I think, is to go back to the original controller touchesBegan
, touchesMoved
method. I will change all my UIButton
s into UIImageView
s, and do touch detection and key animation from the controller.
精彩评论