Breaking News
Home / iOS / iOS Snippets / How to create a PINAnnotationView in IOS?

How to create a PINAnnotationView in IOS?

  1.   Annotation *anno = [[[Annotation alloc] init] autorelease];        
  2. anno.coordinate = xxx// get it map view;        
  3.  
  4. anno.title = @"Current Location";
  5.  anno.subtitle = [NSString stringWithFormat:@"%f, %f", anno.coordinate.latitude, anno.coordinate.longitude];            
  6.  
  7. NSString *defaultPinID = @"xyz..";
  8. pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:anno reuseIdentifier:defaultPinID] autorelease];
  9.  
  10. // customize the pin
  11. pinView.image = [UIImage imageNamed:@"custom_pin.png"];
  12. pinView.opaque = NO;
  13. pinView.canShowCallout = YES;
  14. pinView.draggable = NO;
  15. pinView.annotation = anno;        
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger