40media Loading Accessory callout view for mkannotationview

Loading Accessory callout view for mkannotationview

I have a map annotation view that contains a rightcallout button which loads an accessory view which is a UIViewController class. I am using resuable annotations, but am wondering how I can pass updated information to my UIViewController class. Let's say I have 2 string values which map to 2 UILabels on my view. How can I update those values after the initial accessory view has already been loaded into memory as a resusable view?

Any help would be appreciated.

Is NSTimer auto retained?


Submit ajax form on keyboard close without a submit button on the iphone?
You'll need to maintain a reference to the UILabels in the object that gets the update, and then use setTitle: (I think) to update the labels.

Why does this create a memory leak (iPhone)?
UICachedDeviceWhiteColor and NSAutoRelease for table cell mem leaks

Can I develop an iPhone app using java?

Lock orientation UIWebView on iPhone


How to ALTER sqlite column (iPhone)?
In your annotation subclass you need to override the setTitle method to send the changes to the instance of your UIViewController class that your subclass is holding.

How to escape characters in href=mailto (iPhone)
Or, you could setup your annotation subclass to receive notifications (from NSNotificationCenter), and upon receiving a notification, update the title and the instance of your UIViewController class.. If you are unfamiliar with NSNotifications, then here is a quick reference.

I used these to keep my annotations updated.

NSNotification Example.


Try using the MKMapViewDelegate method:.
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control; 
This method is called when a user tapped one of the annotation view’s accessory buttons.

Assuming that your MKMapViewDelegate is also the UIViewController that can access your accessory view..

70 out of 100 based on 40 user ratings 1090 reviews