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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:43:51+00:00 2026-06-06T00:43:51+00:00

I don’t know how to code this but i want program to skip or

  • 0

I don’t know how to code this but i want program to skip or jump this statement from executing

self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                  target:self
                                                selector:@selector(displayviewsAction:)
                                                userInfo:nil
                                                 repeats:NO];

when pause is pressed to resume play.

Reason i want this cause in play/pause button everything is good except when pause is pressed to resume it starts reloading view controllers by executing this statement from the below code

self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                  target:self
                                                selector:@selector(displayviewsAction:)
                                                userInfo:nil
                                                 repeats:NO];

I have tried so many different ways to solve this issues but nothing is working out.

 if([audioPlayer isPlaying]){
    [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
    [audioPlayer pause];
    [self pauseTimer];
}else {
    [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
    [audioPlayer play];
    [self resumeTimer];
    self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                  target:self
                                                selector:@selector(displayviewsAction:)
                                                userInfo:nil
                                                 repeats:NO];

That’s how loading view controllers one after other

- (void)displayviewsAction:(id)sender
 {  
  First *firstController = [[First alloc] init];
  firstController.view.frame = CGRectMake(0, 0, 320, 480);
  CATransition *transitionAnimation = [CATransition animation];   
  [transitionAnimation setDuration:1];
  [transitionAnimation setType:kCATransitionFade];
  [transitionAnimation setTimingFunction:[CAMediaTimingFunction       functionWithName:kCAMediaTimingFunctionEaseIn]];
  [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFade];
  [self.view addSubview:firstController.view];
  [self.view addSubview:toolbar];
  [firstController release];
  self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];  
  }

  -(void)Second 
  {
   Second *secondController = [[Second alloc] init];
   secondController.view.frame = CGRectMake(0, 0, 320, 480);
   CATransition *transitionAnimation = [CATransition animation];
   [transitionAnimation setDuration:1];
   [transitionAnimation setType:kCATransitionReveal];
   [transitionAnimation setTimingFunction:[CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionEaseIn]];
   [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionReveal];
   [self.view addSubview:secondController.view]; 
   [self.view addSubview:toolbar];
   [secondController release];
   self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
    }

This is my last attempt to see if i can find some solution for this issue. I have spent two weeks on this issue but no success.

If someone can solve my this issue.

Thanks so much for help.

  • 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-06-06T00:43:54+00:00Added an answer on June 6, 2026 at 12:43 am

    I found one little bit complex solution.
    In you .h file create a BOOL isFirstTime; int methodSelector;.
    In your implementation file:

    -(void)viewDidLoad
    {
     isFirstTime = YES;
     methodSelector = 1;
    }
    

    and change your code like this:

    if([audioPlayer isPlaying])
    {
        [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
        [audioPlayer pause];
        [self pauseTimer];
    }
    else
    {
        [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
        [audioPlayer play];
        [self resumeTimer];
    switch(methodSelector)
    {
     case 1:self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                  target:self
                                                selector:@selector(displayviewsAction:)
                                                userInfo:nil
                                                 repeats:NO];
     break;
     case 2:self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];
     break;
     .
     .
     .
    
    
     }
    }
    if(isFirstTime == YES)
    {
        self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                                      target:self
                                                    selector:@selector(displayviewsAction:)
                                                    userInfo:nil
                                                     repeats:NO];
    isFirstTime  = NO;
    }
    

    set the methodSelector in your view changing methods accordingly. In Second method set it as 2 in Third set it as 3 and so on.

    - (void)displayviewsAction:(id)sender
     {  
      First *firstController = [[First alloc] init];
      firstController.view.frame = CGRectMake(0, 0, 320, 480);
      CATransition *transitionAnimation = [CATransition animation];   
      [transitionAnimation setDuration:1];
      [transitionAnimation setType:kCATransitionFade];
      [transitionAnimation setTimingFunction:[CAMediaTimingFunction       functionWithName:kCAMediaTimingFunctionEaseIn]];
      [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFade];
      [self.view addSubview:firstController.view];
      [self.view addSubview:toolbar];
      [firstController release];
    methodSelector = 2;
      self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];  
      }
    
      -(void)Second 
      {
       Second *secondController = [[Second alloc] init];
       secondController.view.frame = CGRectMake(0, 0, 320, 480);
       CATransition *transitionAnimation = [CATransition animation];
       [transitionAnimation setDuration:1];
       [transitionAnimation setType:kCATransitionReveal];
       [transitionAnimation setTimingFunction:[CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionEaseIn]];
       [self.view.layer addAnimation:transitionAnimation forKey:kCATransitionReveal];
       [self.view addSubview:secondController.view]; 
       [self.view addSubview:toolbar];
       [secondController release];
    methodSelector = 3;
       self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
        }
    

    methodSelector is used for calling the method after pausing.

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

Sidebar

Related Questions

don't know better title for this, but here's my code. I have class user
Don't know how to frase this but I found this code wich works as
Don't know if I worded the question right, but basically what I want to
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this is the right place to ask this, but I will
Don't know where else to ask, but from one day to the other my
Don't know why this is happening, but after submitting a form via JS (using
Don't know if this is an eclipse specific problem but whenever I declare a
I don't know if this has been asked before, but what i'd like to
Don't know why but I can't find a solution to this. I have 3

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.