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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:49:27+00:00 2026-05-24T16:49:27+00:00

I am implementing a mapView whereby an annotation will be placed when the user

  • 0

I am implementing a mapView whereby an annotation will be placed when the user search for an address. But somehow, the annotation sometime doesn’t move and update to the new coordinate. It’s only upon zooming the map, then will it update to the new location. The subtitle did get updated though.

- (void)searchBarSearchButtonClicked:(UISearchBar *)theSearchBar {
    SVGeocoder *geocodeRequest = [[SVGeocoder alloc] initWithAddress:searchBar.text inRegion:@"sg"];
    [geocodeRequest setDelegate:self];
    [geocodeRequest startAsynchronous];
}

- (void)geocoder:(SVGeocoder *)geocoder didFindPlacemark:(SVPlacemark *)placemark {
        if (annotation) {
            [annotation moveAnnotation:placemark.coordinate];
            annotation.subtitle = [NSString
                                   stringWithFormat:@"%@", placemark.formattedAddress];
        }
        else {
            annotation = [[MyAnnotation alloc]
                          initWithCoordinate:placemark.coordinate
                          title:@"Tap arrow to use address"
                          subtitle:[NSString
                                    stringWithFormat:@"%@", placemark.formattedAddress]];
            [mapView addAnnotation:annotation];
        }
    MKCoordinateSpan span;
    span.latitudeDelta = .001;
    span.longitudeDelta = .001;
    MKCoordinateRegion region;
    region.center = placemark.coordinate;
    region.span = span;
    [mapView setRegion:region animated:TRUE];

    [searchBar resignFirstResponder];
}
  • 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-05-24T16:49:28+00:00Added an answer on May 24, 2026 at 4:49 pm

    Nothing in your code (that you’ve shown) tells mapView that the annotation’s location has changed. The annotation itself probably can’t do it in -moveAnnotation because annotations generally don’t know what map or maps they’ve been added to (nor should they).

    The right way to move an annotation is to to remove it from the MKMapView that’s using it, update its location, and then add it back to the map. You can’t just change the annotation’s location after it has been added to the map because the map may very well cache the location or sort the annotation according to its location, and there’s no method in MKMapView to tell the map that the location has changed.

    I’d change your conditional to something like this:

    if (annotation == nil) {
        annotation = [[MyAnnotation alloc] init];
        annotation.title = @"Tap arrow to use address";
    }
    [mapView removeAnnotation:annotation];
    [annotation moveAnnotation:placemark.coordinate];
    annotation.subtitle = placemark.formattedAddress;
    [mapView addAnnotation:annotation];
    

    This assumes that it’s safe to call -init in place of -initWithCoordinate:title:subtitle:; if not, you’ll want to change that.

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

Sidebar

Related Questions

I'm implementing a MapView with a search feature, and have to perform some specific
When implementing a needle search of a haystack in an object-oriented way, you essentially
Implementing a custom VM and I've come to use registers (these will store pointers
Im implementing NFS and almoste done but the RFC section 3.3.8 says this in
While implementing my own IFilter I found that most likely some consumers will require
While implementing a flash-based uploader , we were faced with an issue: Flash doesn't
I implementing OLE DB provider for my custom database. It will be used from
I am implementing App vith usage of osmdroid mapView. We have maps with max
I`m implementing a custom filesystem on Ubuntu using Fuse, but I need to trap
Im implementing my own proto in Java, it will use a heartbeat over a

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.