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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:35:36+00:00 2026-06-13T22:35:36+00:00

-(void) movePinsToDestinations:(NSArray *)destination withCompletion: (void (^)())block { … [UIView animateWithDuration:animationTime animations:^{ //[self.ReloadBut setTitle:@Animating forState:UIControlStateNormal];

  • 0
-(void) movePinsToDestinations:(NSArray *)destination withCompletion: (void (^)())block
{
    ...
    [UIView animateWithDuration:animationTime animations:^{
        //[self.ReloadBut setTitle:@"Animating " forState:UIControlStateNormal];
        for (BGAddressAnnotation * anExistingAnnotation in existingAnnotations) {
            if (anExistingAnnotation.destination) {
                anExistingAnnotation.coordinate = anExistingAnnotation.destination.coordinate;
            }
            else
            {
                anExistingAnnotation.myView.alpha = 0;
            }
        }
    } completion:^(BOOL finished){
        NSAssert(finished, @"Not Finished?");
        for (BGAddressAnnotation * existingAnnotation in existingAnnotations) {
            if ([existingAnnotation.destination.myBiz isEqual: existingAnnotation.myBiz]) {
                existingAnnotation.arrayOfBusinesses = existingAnnotation.destination.arrayOfBusinesses;
                existingAnnotation.myView.alpha=1;
            }
            else
            {
                [self.theMapView removeAnnotation:existingAnnotation];
            }
        }
//        PO([[self class] PrintAllAnnotations: [self annotationExceptUser]]);
//        PO([[self class] PrintAllAnnotations: destination]);
        PO(@"Reach Completion Block");
        if (block)
        {
            block();
        }
        else
        {
            //[self.ReloadBut setTitle:@"Animating Finish" forState:UIControlStateNormal];
        }
    }];
}

Result:

2012-11-04 20:00:05.800 @"Start Animating": Start Animating
2012-11-04 20:00:05.805 @"Reach Completion Block": Reach Completion Block

I set the animation to run for 10 seconds and yet completion block is called withhin 5 milisecond. What can possibly do this?

Some background, the function is called twice and the completion block is supposed to call another animation. The second animation is indeed done in 10 seconds. Does specifying completion block make it called immediately or what?

So I am effectively doing

[self movePinsToDestinations:self.myCache.annotationsInterMediateState withCompletion:^{
    [self movePinsToDestinations:self.myCache.annotationsWeShouldbeDisplaying withCompletion:^{
    }];
}];

Update:

Out of curiosity I nested the animation several times.

[self movePinsToDestinations:self.myCache.annotationsInterMediateState withCompletion:^{
    [self movePinsToDestinations:self.myCache.annotationsWeShouldbeDisplaying withCompletion:^{
        [self movePinsToDestinations:emptyAnnotations withCompletion:^{
            [self movePinsToDestinations:startOff withCompletion:^{
                [self movePinsToDestinations:self.myCache.annotationsInterMediateState withCompletion:^{
                    [self movePinsToDestinations:self.myCache.annotationsWeShouldbeDisplaying withCompletion:^{

                    }];
                }];
            }];
        }];
    }];
}];

Here is the result:

21:51.9 Start Animating: Start Animating
21:51.9 (animationTime): 10
21:51.9 Reach Completion Block: Reach Completion Block
21:51.9 Start Animating: Start Animating
21:51.9 (animationTime): 10
21:51.9 Reach Completion Block: Reach Completion Block
21:51.9 Start Animating: Start Animating
21:51.9 (animationTime): 10
22:01.9 Reach Completion Block: Reach Completion Block
22:01.9 Start Animating: Start Animating
22:01.9 (animationTime): 10
22:01.9 Reach Completion Block: Reach Completion Block
22:01.9 Start Animating: Start Animating
22:01.9 (animationTime): 10
22:01.9 Reach Completion Block: Reach Completion Block
22:01.9 Start Animating: Start Animating
22:01.9 (animationTime): 10
22:01.9 Reach Completion Block: Reach Completion Block

So one of the animation is done properly and the block is called 10 seconds after start animating.

It is possible that the block is called immediately because another animation is being called in viewDidAddAnnotation, however, it’s unlikely to be the case because many different animations can be called at the same time.

Most animation still run for a mere miliseconds. Some run for 3 seconds. No other animation should be running.

  • 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-13T22:35:37+00:00Added an answer on June 13, 2026 at 10:35 pm

    This is actually a feature. When nothing is animated then the animation finish immediately. I wonder if there is an option to change that.

    Sometimes this is a good thing. The thing is while there is nothing animated within the existing animation, the added animation need animation independently. The end result is the animation of added pinview is not in sync with the animation of the existing pinView

    Doing self.ReloadBut.alpha = (float) random()/RAND_MAX;, for example, fix the problem.

    I wonder if there is a more elegant way where I can just perform the whole animation on didAddAnnotationViews. Alternatively I can have a hidden view moving around in case I know that some new pins are added.

    It’s kinf of nice to be able to animate newly added pins at the same time with existing pins. I’ll think about it.

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

Sidebar

Related Questions

- (void) hideMenu { UIView *currentView = [self view]; [UIView beginAnimations:nil context: nil]; [UIView
- (void)viewDidLoad{ UIView *baseView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; [self.view addSubview:baseView]; //
- (void)viewDidLoad { [super viewDidLoad]; [VenueManager searchNear:@Orlando onLoad:^(NSArray *objects) { self.locationObjects = objects; [self.tableView
- (void)TargetHit:(int)target{ void (^threadBlock)(void) = ^{ NSLog(@respond to selector %d, [self respondsToSelector:@selector(changeImageOfTarget:)]); [[NSOperationQueue mainQueue]
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { self.listFeedConnection = nil; // release our connection [UIApplication sharedApplication].networkActivityIndicatorVisible =
- (void)fadeOutSplash { UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@Default-Landscape~ipad.png]]; [self.window.rootViewController.view addSubview:splash]; // <--
- (void)viewDidLoad { moveObjectTimer = [NSTimer timerWithTimeInterval:0.1 target:self selector:@selector(moveObject) userInfo:nil repeats:YES] -(void)moveObject image.center =
- (void)viewDidLoad { [super viewDidLoad]; ac = [[AddContacts alloc]init]; self.navigationController = [[UINavigationController alloc] initWithRootViewController:ac];
-(void)createSprite{ CCSprite *shotV = [CCSprite spriteWithFile:@green.png]; [self addChild:shotV z:1]; [shotVArray addObject:shotV]; NSlog(@%@,shotV); } -(void)aSpecialCase{
- (void)removeObjectsInArray:(NSArray *)otherArray Removes from the receiving array the objects in another given array.

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.