Reputation: 33
I need to make one button with two actions, touch down used to play a sound and then touch up inside to stop playing the sound when you let go of the button
Upvotes: 1
Views: 2513
Reputation: 4746
Connect two methods to both these actions.
[self.yourBtn addTarget:self action:@selector(touchDownMethod:) forControlEvents:UIControlEventTouchDown];
[self.yourBtn addTarget:self action:@selector(touchUpInsideMethod:) forControlEvents:UIControlEventTouchUpInside];
Upvotes: 4