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 7554831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:26:42+00:00 2026-05-30T11:26:42+00:00

Want to pause the multiple views from updating when Pause button is pressed In

  • 0

Want to pause the multiple views from updating when Pause button is pressed

In h file

@property BOOL appIsPaused;

In m file

@synthesize appIsPaused;

-(void)playpauseAction:(id)sender 
{

if  

  ([audioPlayer isPlaying]){

 [sender setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateSelected];

      [audioPlayer pause];

      appIsPaused = YES;

  } else {

 [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];

      [audioPlayer play];

      appIsPaused = NO;

      [self performSelector:@selector(displayviewsAction:) withObject:nil afterDelay:11.0];

  }  

}

- (void)displayviewsAction:(id)sender
{
FirstViewController *viewController = [[FirstViewController alloc] init];

viewController.view.frame = CGRectMake(0, 0, 320, 480);

[self.view addSubview:viewController.view];

[self.view addSubview:toolbar];

[self performSelector:@selector(secondViewController) withObject:nil afterDelay:23];

[viewController release];

}

-(void)secondViewController {
SecondViewController *secondController = [[SecondViewController alloc] init];

secondController.view.frame = CGRectMake(0, 0, 320, 480);

[self.view addSubview:secondController.view]; 

[self.view addSubview:toolbar];

[self performSelector:@selector(ThirdviewController) withObject:nil afterDelay:27];

[secondController release];
}

and it goes on like this for multiple views.

Any ideas how to pause views from updating whenever pause button is pressed.

  • 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-30T11:26:44+00:00Added an answer on May 30, 2026 at 11:26 am

    Instead of using performSelector after delay, you should consider using a NSTimer.

    Like this:

    Declare a NSTimer *timer ivar.
    Declare a NSUInteger viewControl;

    Set viewControl to 0;

    On the play part of the method add this line:

    timer = [NSTimer scheduledTimerWithTimeInterval:11 target:self selector:@selector(tick) userInfo:nil repeats:YES];
    
    -(void)tick
    {
        switch(viewControl)
        {
            case 0:
                [self performSelector:@selector(firstViewController) withObject:nil];
                break;
            case 1:
               [self performSelector:@selector(secondViewController) withObject:nil];
                break;
            case 2:
               [self performSelector:@selector(thirdViewController) withObject:nil];
               break;
            .
            .
            .
            default:
                break;
        }
    
        viewControl++;
    
        if(viewControl > MAX_VIEWS)
        {
             viewControl = 0;
        }
    }
    

    And add this line on pause action:

    [timer invalidate]
    

    It is also cleaner and let you have more control over your code.

    Hope it helps.

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

Sidebar

Related Questions

I want to write multiple image files to a odt file. I will be
I want to pause input in a shell script, and prompt the user for
Let's say I want to pause a thread so that other threads can run
In Javascript, I want my onmouseout event to sleep/pause/wait/ (not sure of the proper
I want to parse a config file sorta thing, like so: [KEY:Value] [SUBKEY:SubValue] Now
I want to parse an Apache access.log file with a python program in a
I want to parse the input string and extract the values from it. My
I have multiple checkboxes with name=ap[] and want to use jquery to convert the
I want my script's execution to pause for about a half of a second.
I want to parse string in php with multiple delimiters I use this code

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.