I am creating a music player application and it need that 2 actions to be called from a single button, one to skip to next track by touch up inside event and other to fast forward the curenttrack incase of a 'long press'. I don't know which event is pointing to this long press, i thought it to be touch down, but it worked only while holding the button. When i released the button, the track was skipped to next item. pls help
AVAudioPlayer *appSoundPlayer;// declared in .h file
In m file, the method:
-(void)seekForwards{
NSTimeInterval timex;
timex = appSoundPlayer.currentTime;
timex = timex+5; // forward 5 secs
appSoundPlayer.currentTime = timex;
timex = 0;
}
Best Answer
Personally I'd just track the button's state with an integer on your view controller or within a button subclass. If you track what the button is doing you can control what each of the actions do. In your .h file put in some stuff like this:
And then in your .m file throw in some of this stuff:
After that just link the button's actions to what I've noted in the comments before the IBactions. I haven't tested this but it should work.