I have setup an NSMutableArray of objects derived from a class that conforms to the MKAnnotation protocol. I have setup setup title and subtitle for the annotation and have
Here's the most simple solution I could find. What it does is drops a single pin on the UIMapView in viewDidLoad event.
The project references MapKit framework
The view have the following import:#import
The view controller implements MKMapViewDelegate protocol
The view controller implementation contains:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation
{
MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"];
newAnnotation.pinColor = MKPinAnnotationColorGreen;
newAnnotation.animatesDrop = YES;
newAnnotation.canShowCallout = NO;
[newAnnotation setSelected:YES animated:YES];
return newAnnotation;
}
CLLocationCoordinate2D geos = CLLocationCoordinate2DMake(0.2344, 45.324);
MKPlacemark* marker = [[MKPlacemark alloc] initWithCoordinate:geos addressDictionary:nil];
[mapView addAnnotation:marker];
[marker release];