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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:34:01+00:00 2026-06-11T07:34:01+00:00

As you can see below, I have simulated my problem in a basic way.

  • 0

As you can see below, I have simulated my problem in a basic way. I have a timer that calls a method periodically. In that method, I have created a switch-case condition to simulate my idea.

Once pin is added on the map, then reading (pin keeps dropping) them again.

I want to add my pin and then just only change the title that represents a weather value.

- (IBAction)playBtn:(id)sender {

     timer = [NSTimer scheduledTimerWithTimeInterval:(4.0) target:self selector:@selector(control) userInfo:nil repeats:YES];

}

-(void)control{
    NSMutableArray *annotationArray = [[[NSMutableArray alloc] init] autorelease];

    switch (value%2) {
        case 0:
        {

    // Create some annotations
    Annotation *annotation = nil;

    annotation = [[Annotation alloc] init];
    annotation.coordinate = CLLocationCoordinate2DMake(29.7161,-95.3906);
    annotation.color = RGB(13, 0, 182);
    annotation.title = @"17";
    [annotationArray addObject:annotation];
    [annotation release];

    annotation = [[Annotation alloc] init];
    annotation.coordinate = CLLocationCoordinate2DMake(30.168456,-95.504480);
    annotation.color = RGB(0, 182, 146);
    annotation.title = @"16";
    [annotationArray addObject:annotation];
    [annotation release];


    // Center map
    //self.mapView.visibleMapRect = [self makeMapRectWithAnnotations:annotationArray];

    // Add to map
    //[self.mapView addAnnotations:annotationArray];
        }
            break;
        case 1:
        {
            // Create some annotations
            Annotation *annotation = nil;

            annotation = [[Annotation alloc] init];
            annotation.coordinate = CLLocationCoordinate2DMake(29.7161,-95.3906);
            annotation.color = RGB(13, 0, 182);
            annotation.title = @"27";
            [annotationArray addObject:annotation];
            [annotation release];

            annotation = [[Annotation alloc] init];
            annotation.coordinate = CLLocationCoordinate2DMake(30.168456,-95.504480);
            annotation.color = RGB(0, 182, 146);
            annotation.title = @"25";
            [annotationArray addObject:annotation];
            [annotation release];

        }
            break;
    }
    [self.mapView addAnnotations:annotationArray];
    [mapView setNeedsDisplay];
    value++;
  • 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-11T07:34:03+00:00Added an answer on June 11, 2026 at 7:34 am

    If you want to update the properties of an annotation that has already been added to the map, adding it again with the new properties (without first removing the old one) just creates and adds another annotation at the same location (with the new properties).

    As you saw, calling removeAnnotation and then addAnnotation results in flicker and another drop animation.

    Instead, you have to get a reference to the existing annotation and then update its properties.

    If it’s just one annotation, you could keep a class-level ivar reference to it and update the properties with that reference when the values change.

    If you need to update different annotations at different times, a simple way is to search the map view’s annotations array for the annotation you want to update.

    This requires that you have a property in your annotation class that will be unique for each annotation and (ideally) remain constant for each annotation. In other words: if you’re going to be updating the annotation’s title, don’t use the title as the “unique” annotation identifier.

    Instead, add another property (eg. an int or string) that you assign to each annotation when creating it and which won’t change so you can find the annotation later using that value.

    For example, assume you add an int property called annotationId to your annotation class and you want to update the annotation with id# 42:

    BOOL annFound = NO;
    
    //loop through the map view's annotations array to find annotation id# 42...
    for (id<MKAnnotation> ann in mapView.annotations)
    {
        if ([ann isKindOfClass:[MyAnnotationClass class]])
        {
            MyAnnotationClass *myAnn = (MyAnnotationClass *)ann;
            if (myAnn.annotationId == 42)
            {
                annFound = YES;
                myAnn.title = @"some new title";
                break;
            }
        }
    }
    
    if (!annFound)
    {
        //annotation id# 42 is not yet on the map.
        //create it and add to map... 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you can see below I have created a little program to concatenate 2
Trying not to lose it here. As you can see below I have assigned
As you can see below, I have Parallel.For loop. If run the program while
In my application I have an edit profile page which you can see below;
I have two async classes in my application which you can see below class
i have a pretty complicated form. as you can see below: alt text http://img9.imageshack.us/img9/2465/test2xk.jpg
I have a SOAP message (see below). Using Xpath, how can I extract the
I have this code below. As you can see I am passing two variables
I have some really funky code. As you can see from the code below
**Updated: (See below)**I have been looking around for couple of days and can't find

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.