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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:12:35+00:00 2026-05-24T04:12:35+00:00

I have a mapView with only on MKAnnotation, that has a costume image. When

  • 0

I have a mapView with only on MKAnnotation, that has a costume image. When the user changes the mapType, I need to change the image of that annotation.

The way I did that was to remove the annotation from the map, and insert another with the correct image, bu i don’t think is the best way. It takes about 1 ou 2 seconds to show the new image.

How can I do it without remove the annotation and drop another?

Thanks,

RL

  • 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-24T04:12:36+00:00Added an answer on May 24, 2026 at 4:12 am

    You can use the viewForAnnotation: instance method of the map view (not the same as its delegate method with a similar name) to get the current view of the annotation and force the image change explicitly.

    For example, at the place where the map type is changed:

    MKAnnotationView *av = [mapView viewForAnnotation:annotation];
    
    if (mapView.mapType == MKMapTypeHybrid)
        av.image = [UIImage imageNamed: @"hybrid.png"];
    else
        av.image = [UIImage imageNamed: @"standard.png"];
    

    However, you should add the exact same if-statement to the viewForAnnotation delegate method also so when the map view later calls the delegate method itself, it will set the correct image also.

    You may want to move the image-setting logic to a common method that you can call from the place where you change the map type and from the viewForAnnotation delegate method (the MKAnnotationView object would be passed as a parameter). If the logic is in one place, you don’t have to remember to keep both places in sync.

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

Sidebar

Related Questions

I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is
I have an app, that uses mapview. i can only see the map, when
I have balloon popups showing in Android MapView when a user tap:s on specific
I have built an android application which has a single mapview. I have a
i have a mapView with pins on it, and the following code for CLLocation
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
I have a list of several hundred locations and only want to display an
I have a view with a tableView and a mapView. In portrait mode, I
I use the loop below to populate my MapView. However it always shows only
I have an activity MyActivity that extends from MapActivity. In the .xml file containing

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.