iphone - Reverse Geocoding on MKMapView by dragging Pins -


i have subclass "location" of nsmanagedobject , class conforms mkannotation.

when add location map...the reversegeocoder starts. clicking pin see in callout view address of pin. works fine.

now problem.

i able drag pins. when finished dragging, again reversegeocoder starts ask location data. still have old address in callout view, although placemarks updated in location object. after dragging again can see new address. (of course new 1 isn't new anymore, because dragged).

here code dragging state:

- (void)mapview:(mkmapview *)mapview annotationview:(mkannotationview *)annotationview didchangedragstate:(mkannotationviewdragstate)newstate fromoldstate:(mkannotationviewdragstate)oldstate{  //if dragging ended if (newstate == mkannotationviewdragstatenone && oldstate == mkannotationviewdragstateending) {      cllocation *location = [[cllocation alloc] initwithlatitude:annotationview.annotation.coordinate.latitude longitude:annotationview.annotation.coordinate.longitude];     [self geocodelocation:location forannotation:annotationview.annotation];     [location release]; } 

and code reverse geocoder delegate

- (void)reversegeocoder:(mkreversegeocoder*)geocoder didfindplacemark:(mkplacemark*)place {     location*    theannotation = [self.map annotationforcoordinate:place.coordinate];     if (!theannotation)         return;     // associate placemark annotation.     theannotation.city = [place locality];     theannotation.zipcode = [place postalcode];     theannotation.street = [place thoroughfare];      debuglog(@"place: %@", place);       // add more info button annotation's view.     mkpinannotationview*  view = (mkpinannotationview*)[self.map viewforannotation:theannotation];     if (view)     {         debuglog(@"subtitle: %@", theannotation.subtitle);         view.leftcalloutaccessoryview = [uibutton buttonwithtype:uibuttontypedetaildisclosure];      } } 

any wonderful. in end maps app best example doing dragging.

i figured out.

because of kvo hust hace set subtitle of location object. gets displayed.

but because subtilte generated

// associate placemark annotation. theannotation.city = [place locality]; theannotation.zipcode = [place postalcode]; theannotation.street = [place thoroughfare]; 

i had following in nsmanagedobject subclass.

- (void) setsubtitle:(nsstring *)title{ //do nothing} 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -