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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:10:01+00:00 2026-05-14T07:10:01+00:00

I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is

  • 0

I have a mapview with several annotations. Every annotation has a leftCalloutAccessoryView which is a UIViewController class. The reason for this is that I want every annotation to load some data from the server, and add the result of that data to the annotation subTitle.
This all works perfectly, except that I don’t want to load all that data when my app is started, but I want to the remote call to be done only when the callout bubble is opened.

Does anybody know how I can do this? The viewWillload, viewDidLoad ect. don’t work in this case. Any examples as well?

  • 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-14T07:10:01+00:00Added an answer on May 14, 2026 at 7:10 am

    I solved the issue adding an observer. The observer then does its thing and after that the callout shows up.

    Something I had problems with is that I couldn’t update the information in the callout bubble after the bubble is shown. The only way to do this is to create your own callout bubble (as I understand it), which is something I didn’t feel like given that I have a deadline.
    I fixed that by adding an extra UIView with an alpha on it and a text “Getting location data…”. I just show up that view when pressing an location and when the observer is done, I hide the view again (off course by using an animation).

    Hope my answer helped others.

    Code:

    [pin addObserver:self
          forKeyPath:@"selected"
             options:NSKeyValueObservingOptionNew
             context:GMAP_ANNOTATION_SELECTED];
    

    Some more code:

    - (void)observeValueForKeyPath:(NSString *)keyPath
                          ofObject:(id)object
                            change:(NSDictionary *)change
                           context:(void *)context{
    
        NSString *action = (NSString*)context;
    
        MKAnnotationView *annotationView = [(MKAnnotationView*)object retain];
        BikeAnnotation *bike = [[annotationView annotation] retain];
    
        if([action isEqualToString:GMAP_ANNOTATION_SELECTED] && [[bike _stationType] intValue] != 5 && [[bike _stationType] intValue] != 6){
            BOOL annotationAppeared = [[change valueForKey:@"new"] boolValue];
            if (annotationAppeared) {
                NSLog(@"Annotation selected");
            else {
                NSLog(@"annotation deselected");
            }
        }
    }
    

    And put this just after the @synthesize’s:

    NSString * const GMAP_ANNOTATION_SELECTED = @"gmapselected";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm developing an application for iPad. I have a mapview with several annotations. I
I have a mapView activity that has a LocationListener registered to check for a
I have a list of several hundred locations and only want to display an
I have a handler that receives a message on every location update, every 5
I have an activity that extends MapActivity, and inside onCreate() I have this code
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you managed to get Aptana Studio debugging to work? I tried following this,
I am new to Android development and I have a problem that I have
I have a WPF UserControl that I'd like to inject dependencies into. What's the
Say I have mapview control in my Android app. If I know a landmark

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.