Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 504651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:31:04+00:00 2026-05-13T06:31:04+00:00

I am creating a music player application and it need that 2 actions to

  • 0

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;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:31:05+00:00Added an answer on May 13, 2026 at 6:31 am

    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:

    enum {
        MyButtonScanning,
        MyButtonStalling,
        MyButtonIdle
    };
    
    
    
    @interface YourClass : UIViewController {
        NSInteger buttonModeAt;
    }
    @property (nonatomic) NSInteger buttonModeAt;
    -(IBAction)buttonPushedDown:(id)sender;
    -(void)tryScanForward:(id)sender;
    -(IBAction)buttonReleasedOutside:(id)sender;
    -(IBAction)buttonReleasedInside:(id)sender;
    @end
    

    And then in your .m file throw in some of this stuff:

    @implementation YourClass
    ///in your .m file
    @synthesize buttonModeAt;
    
    
    ///link this to your button's touch down
    -(IBAction)buttonPushedDown:(id)sender {
        buttonModeAt = MyButtonStalling;
        [self performSelector:@selector(tryScanForward:) withObject:nil afterDelay:1.0];
    }
    
    -(void)tryScanForward:(id)sender {
        if (buttonModeAt == MyButtonStalling) {
            ///the button was not released so let's start scanning
            buttonModeAt = MyButtonScanning;
    
            ////your actual scanning code or a call to it can go here
            [self startScanForward];
        }
    }
    
    ////you will link this to the button's touch up outside
    -(IBAction)buttonReleasedOutside:(id)sender {
        if (buttonModeAt == MyButtonScanning) {
            ///they released the button and stopped scanning forward
            [self stopScanForward];
        } else if (buttonModeAt == MyButtonStalling) {
            ///they released the button before the delay period finished
            ///but it was outside, so we do nothing
        }
    
        self.buttonModeAt = MyButtonIdle;
    }
    
    ////you will link this to the button's touch up inside
    -(IBAction)buttonReleasedInside:(id)sender {
        if (buttonModeAt == MyButtonScanning) {
            ///they released the button and stopped scanning forward
            [self stopScanForward];
        } else if (buttonModeAt == MyButtonStalling) {
            ///they released the button before the delay period finished so we skip forward
            [self skipForward];
        }
    
        self.buttonModeAt = MyButtonIdle;
    
    }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a little JavaScript music player that sits on the btottom of
I'm planning of creating a Last.FM scrobbler plugin for a music player in Windows.
i am creating a music application and i want to integrate facebook into my
i am creating a music application in iphone where i am integrating twitter in
I'm creating an online music store application (in Java) for signed and unsigned artist
We're currently creating an online music store that allows, only for administrators, to upload
When creating a web application, and lets say you have a User object denoting
While creating classes in Java I often find myself creating instance-level collections that I
I was trying out the method of creating a background music for a java
Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.