iphone - Extracting MKAnnotation Callout's Title When Sender -


ok guys, have map view annotations , when tapped, display callouts disclosure icon on right. when tapped, function called:

- (void)showdetails:(id)sender {     nslog(@"showdetails: called!");     nslog(@"sender: %@",sender);     permitdetailviewcontroller *permitdetail = [[permitdetailviewcontroller alloc] initwithstyle:uitableviewstylegrouped];     nslog(@"permitdetail.title: %@",permitdetail.title);     permitdetail.title = sender.title; //compiler doesn't this!     nslog(@"permitdetail.title: %@",permitdetail.title);     [self.navigationcontroller pushviewcontroller:permitdetail animated:yes];     [permitdetail release]; } 

all , far, need know callout's title was. trying sender.title ain't working well... ideas?

this console output when change problematic line permitdetail.title = self.title;:

2010-12-02 11:50:06.044 parking[55413:207] showdetails: called! 2010-12-02 11:50:06.045 parking[55413:207] sender: <uibutton: 0x8139890; frame = (104 8; 29 31); opaque = no; autoresize = lm; layer = <calayer: 0x8139920>> 2010-12-02 11:50:06.045 parking[55413:207] permitdetail.title: (null) 2010-12-02 11:50:06.045 parking[55413:207] permitdetail.title: permits 

the sender in case callout button (not mkannotation) doesn't have title property.

in viewforannotation, remove addtarget on disclosure button. set annotation view's rightcalloutaccessoryview button.

then implement calloutaccessorycontroltapped delegate method called when callout tapped. provides reference annotation view in call. annotation view contains reference annotation:

- (void)mapview:(mkmapview *)mapview          annotationview:(mkannotationview *)view          calloutaccessorycontroltapped:(uicontrol *)control {     nslog(@"callout annotation.title = %@", view.annotation.title);      //do show details thing here... } 

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? -