Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [self.mapView selectAnnotation:annotation animated:YES];
- @interface MyAnnotation : NSObject <MKAnnotation> {
- NSString *title;
- NSString *subtitle;
- }
- @property (nonatomic, copy) NSString *title;
- @property (nonatomic, copy) NSString *subtitle;
- @end
- #import "MyAnnotation.h"
- @implementation MyAnnotation
- @synthesize title, subtitle;
- @end
- MyAnnotation *foo = [[MyAnnotation alloc] init];
- foo.title = @"I am Foo";
- foo.subtitle = "I am jus' a subtitle";
- -(MKAnnotationView *)mapView:(MKMapView *)_mapView viewForAnnotation:(id<MKAnnotation>)annotation
- {
- static NSString *AnnotationViewIdentifier = @"AnnotationViewIdentifier";
- MKPinAnnotationView *annotationView = (MKPinAnnotationView *)[_mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewIdentifier];
- if (annotationView == nil)
- {
- annotationView = [[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:AnnotationViewIdentifier]autorelease];
- }
- annotationView.canShowCallout = YES;
- return annotationView;
- }
Add Comment
Please, Sign In to add comment