Note that there are some explanatory texts on larger screens.

plurals
  1. POchecking which map view annotation is tapped on mkmapview
    text
    copied!<p>I am having problem in knowing which annotation is tapped on MKMapView. </p> <p>let me explain my problem, there is a simple view controller on which map view is loaded. </p> <p>my annotation class "MapViewAnnotation.h" is as follows</p> <pre><code>@interface MapViewAnnotation : NSObject &lt;MKAnnotation&gt; { NSString *title; CLLocationCoordinate2D coordinate; NSString *sID; NSString *zipCode; } @property (nonatomic, copy) NSString *title; @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, retain) NSString *sID; @property (nonatomic, retain) NSString *zipCode; - (id)initWithTitle:(NSString *)titleOfPin andStoreId:(NSString *)storeIdForDetails andCoordinate:(CLLocationCoordinate2D)coordinateOfPin andZipCode:(NSString *)zip; </code></pre> <p>here is my "MapViewAnnotation.m" file.</p> <pre><code>#import "MapViewAnnotation.h" #import &lt;MapKit/MapKit.h&gt; @implementation MapViewAnnotation @synthesize title, coordinate,storeId,zipCode; - (id)initWithTitle:(NSString *)titleOfPin andStoreId:(NSString *)storeIdForDetails andCoordinate:(CLLocationCoordinate2D)coordinateOfPin andZipCode:(NSString *)zip { [super init]; title = titleOfPin; coordinate = coordinateOfPin; sID = storeIdForDetails; zipCode = zip; return self; } -(void)dealloc { [title release]; [super dealloc]; } @end </code></pre> <p>and this is my viewcontroller.m file</p> <pre><code>- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { //I want to access the sID property of that annotation here. PLEASE HELP ME HOW CAN I DO THAT if (!storeDetailControllerObject) { storeDetailControllerObject = [[StoreDetailController alloc]init]; } // storeDetailControllerObject.storeId = [view.annotation storeId]; [self.navigationController pushViewController:storeDetailControllerObject animated:YES]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload