Is there an easy way to add a sound to a button on every touch down event?
Because I have a lot of buttons in my project, and maybe there is a way to do this.
Any help is appreciated,
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a subclass of UIButton that overwrites the
touchesBegan:withEvent:method and have it play a sound. Just be sure to also call[super touchesBegan:touches withEvent:event];and[self.nextResponder touchesBegan:touches withEvent:event];(I forget if both are necessary) to ensure the touch gets passed on