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

  • SEARCH
  • Home
  • 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 883929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:40:21+00:00 2026-05-15T12:40:21+00:00

i have a simple UIButton that, once clicked, plays a 1 second sound. i

  • 0

i have a simple UIButton that, once clicked, plays a 1 second sound. i want to be able to click that button really fast and produce that sound as many times as i humanly can.

i currently have this up and running by including the and maybe that is where the culprit is… also, i am digging into apple’s references and cannot find the info for how quick is a UIButton to respond to each event and how, if at all, i can control and manipulate this value.

should i switch to a different audio framework like the “audio toolbox” or is there a way for me to speed things up, or perhaps instruct a button to accept a 2nd and 3rd press while the action of the first press is still underway.

cheers!

~nir.

  • 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-15T12:40:21+00:00Added an answer on May 15, 2026 at 12:40 pm

    Create a method to play the sound separate from the button handler method. Let’s say you call it playSound. In your button handler, execute that method in the background with:

    [self performSelectorInBackground:@selector(playSound) withObject:nil];
    

    That does incur additional overhead to spawn off a thread before it can play the sound. If you want to speed it up a bit more, create a pool of worker threads and use:

    [self performSelector:@selector(playSound) 
                 onThread:nextThread 
               withObject:nil 
            waitUntilDone:NO];
    

    To create the pool of worker threads:

    -(void)stillWorking {
        NSLog(@"Still working!");
    }
    
    -(void)workerThreadMain {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
        NSTimer *threadTimer = [NSTimer scheduledTimerWithTimeInterval:10 
                                                                target:self 
                                                              selector:@selector(stillWorking) 
                                                              userInfo:nil 
                                                               repeats:YES];
    
        [[NSRunLoop currentRunLoop] addTimer:threadTimer forMode:NSDefaultRunLoopMode];
        [[NSRunLoop currentRunLoop] run];
    
        [pool drain];
    }
    
    -(NSArray*)createWorkerThreads { 
        NSMutableArray *threadArray = [[[NSMutableArray alloc] initWithCapacity:10]autorelease];
        NSThread *workerThread;
    
        for (i=0;i<10;i++) {
            workerThread = [[NSThread alloc]initWithTarget:self 
                                                  selector:@selector(workerThreadMain) 
                                                    object:nil];
            [workerThread start];
            [threadArray addObject:workerThread];
        }
        return [NSArray arrayWithArray:threadArray];
    }
    

    (This code is untested and may require some debugging, but it should get you going in the right direction.)

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

Sidebar

Related Questions

I have a simple UIButton with an Alpha property that I would like to
I have a simple button and I want to put an image inside, so
I have a simple view with a textbox and a UIButton. When I click
This is something that is stumping me; I have a simple UIButton with the
I have a very simply subclass of UIButton that will fire off a custom
I have simple win service, that executes few tasks periodically. How should I pass
I have simple WinForms application where modifying Windows Registry. The problem is that in
I have a problem that hopefully has a simple solution. I am trying to
I'm trying to figure out how i can have an image with click-able content.
Isn't UIButton supposed to become grayish/grayer when enabled=NO ? I have a simple UIButton

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.