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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:21:30+00:00 2026-06-07T16:21:30+00:00

Connected rewindButton with playButton programmatically. rewindButton is simply rewinding and playing from the beginning

  • 0

Connected rewindButton with playButton programmatically. rewindButton is simply rewinding and playing from the beginning and playButton toggles from play to pause.In the rewindButton method used statement to change the UIImage of UIButton2 when UIButton1 is pressed. That is working fine.

PlayButton method is working fine when play button is pressed and paused. Even after resuming is working fine.

Issue briefing:

When rewindButton is pressed it will change the UIImage of playButton to PauseImage so that user can pause. Problem arises when pause is resumed. When pause is resumed it is reloading view controllers.It should load viewcontrollers only for the first time as per code.

-(void)rewind:(id)sender{
audioPlayer.currentTime = 0;
[timer invalidate];
ContainerViewController *viewController = [[[ContainerViewController alloc] init]autorelease];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view]; 
[self.view addSubview:toolbar];
[audioPlayer play];
self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                    target:self
                                    selector:@selector(displayviewsAction:)
                                    userInfo:nil
                                    repeats:NO];
    [_playButton setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];   
 }



-(void)playpauseAction:(id)sender {

if([audioPlayer isPlaying])
{
    [sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
    [audioPlayer pause];
    [self pauseTimer];
    [self pauseLayer:self.view.layer];

}else{
    [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
    [audioPlayer play];
    [self resumeTimer];
    [self resumeLayer:self.view.layer];

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

- (void)displayviewsAction:(id)sender
{  

 First *first = [[First alloc] init];
 first.view.frame = CGRectMake(0, 0, 320, 425);
 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:first.view];
 [first release];   
 self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];     
 }

-(void)Second 
{
Second *second = [[Second alloc] init];
second.view.frame = CGRectMake(0, 0, 320, 425);
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:second.view]; 
[second release];
self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
}
  • 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-07T16:21:33+00:00Added an answer on June 7, 2026 at 4:21 pm

    Reason it was reloading view controllers after resuming cause in the rewind method i forgot to add isFirstTime == YES for loading view controllers. Viewcontrollers are not required to reload. Viewcontrollers are required to start loading from the beginning only for the first time only.

    So after setting the value of isFirstTime == YES in rewind method now it is not reloading view controllers from the beginning after it is resumed from the pause.

    -(void)rewind:(id)sender{
    audioPlayer.currentTime = 0;
    [timer invalidate];
    ContainerViewController *viewController = [[[ContainerViewController alloc] init]autorelease];
    viewController.view.frame = CGRectMake(0, 0, 320, 480);
    [self.view addSubview:viewController.view]; 
    [self.view addSubview:toolbar];
    [audioPlayer play];
    if(isFirstTime == YES){
    self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
                                    target:self
                                    selector:@selector(displayviewsAction:)
                                    userInfo:nil
                                    repeats:NO];
     isFirstTime  = NO;
    }
    
    [_playButton setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];   
     }
    

    Now it is working fine.

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

Sidebar

Related Questions

I connected to Amazon's linux instance from ssh using private key. I am trying
I have a model connected to a log, so I'm beginning to build ways
It is connected to BI and merging of data from different data sources and
I connected to MySQL from PHP using root user. Connection object was $con .
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I have a tableView connected to coreData. Is it possible to use the method
//connected to db if (isset($_POST['teacherusername'])) { $_SESSION['teacherusername'] = $_POST['teacherusername']; } $sql = SELECT TeacherId
I connected a SQLite db to my ipad app. where the db has two
I connected mainViewController and customTableViewController with a push segue. The mainViewController pass an array
I successfully connected to my database when it was SQL Server 2008 R2. However

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.