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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:21:00+00:00 2026-06-13T12:21:00+00:00

UPDATE ViewController is not destroyed, new ViewController is not created. This: TimerViewController * timerViewController

  • 0

UPDATE

ViewController is not destroyed, new ViewController is not created. This:

TimerViewController * timerViewController = (TimerViewController *)[segue destinationViewController];

does not create a new instance. However, this

TimerViewController *timerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"theID"];

does. So a new instance is now being used, but the same problem.

END UPDATE

I have a simple “analog digital timer” where the minutes and seconds animate smoothly to emulate the turning of a number wheel. This is simply a ParentViewController with a list of times, selecting a time performs a segue to the TimerViewController. The TimerViewController uses a recursive UIView animation to simulate the countdown of a clock. This works well.

I want the user to be able to transition to the next timer in the list without having to go back to the ParentViewController in order to select it. This does not work well.

I’ve tried many variations, the basic pattern is for TimerViewController to ask its delegate (ParentViewController) to pop it and then to seque again to the TimerViewController using the next time from the list of times. The initial animation never terminates, the initial TimerViewController instance never “dies”. When I segue to TimerViewController the second time, using what I thought was a new instance, the first animation appears to still be running, the duration of the animation which started at almost 1.0s is off the charts (closer to 0.).

I’ve tried many different, increasingly desperate, ways to stop the original animation and kill the original instance.

ParentViewController.m

-(void) timerViewControllerDidSwipe  (TimerViewController *)controller {

  [self.navigationController  popViewControllerAnimated:NO];
  controller = nil; // ?
  [self performSegueWithIdentifier:@"ShowTimer" sender:self];

}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

if ([[segue identifier] isEqualToString:@"ShowTimer"])
{
    TimerViewController * timerViewController = (TimerViewController *)[segue destinationViewController];
    [timerViewController setDelegate:self];
}


TimerViewController.m  

-(void) swipe:(id)selector {
    // swipe left
     stop = YES; // ivar for ^after to not call [self animate]
    [self.delegate timerViewControllerDidSwipe:self];
}

-(void) animate {

// anim block here..

 void (^after) (BOOL) = ^(BOOL f) {

    if (duration % 60 == 0 && duration >= 60) {

         if (minutesAlt.center.y < minutes.center.y)
         {
             CGPoint a = minutes.center;
             a.y -= 2 * displacement;
             minutes.center = a;
             minutes.text = [NSString stringWithFormat:@"%02d", (duration / 60) -1];
         }
         else
         {
            CGPoint a = minutesAlt.center;
            a.y -= 2 * displacement;
            minutesAlt.center = a;
            minutesAlt.text = [NSString stringWithFormat:@"%02d", (duration / 60) -1];
         }
    }

    if (duration == 0)
    {
        // end
    }
    else if (secondsAlt.center.y < seconds.center.y)
    {
        CGPoint a = seconds.center;
        a.y -= 2 * displacement;
        seconds.center = a;
        duration--;
        seconds.text = [NSString stringWithFormat:@"%02d",duration % 60];

        if (!stop) {[self animate];}
    }
    else 
    {
        CGPoint a = secondsAlt.center;
        a.y -= 2 * displacement;
        duration--;
        secondsAlt.center = a;
        secondsAlt.text = [NSString stringWithFormat:@"%02d", duration % 60];

        if (!stop) {[self animate];}
    }
};


[UIView animateWithDuration:0.50
                      delay:0.50
                    options:UIViewAnimationOptionCurveLinear
                 animations:anim
                 completion:after];
}

Any help greatly appreciated.

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

    Fixed here in a related question. It was a simple syntax error (that took me weeks to find).

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

Sidebar

Related Questions

Update: I reported this as a bug to Apple and they fixed it! All
UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
Update : This is no longer an issue from C# 6, which has introduced
Update : Unfortunately the help offered below did not solve my problem of sharing
Update It has been mentioned that viewWillAppear and viewDidAppear do not get called per
This only happens from time to time, seems random and I have not been
UPDATE It turns out that the code below is not actually the problem. In
This is an objective-c problem. I have created a subclass person of NSObject with
I have a Table View Controller with cells. I want to update the text
Update: Is there a way to achieve what I'm trying to do in an

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.