Tuesday, 16 October 2012

Showing the ping for the particular lat long in iPhone

NSMutableArray *locs = [[NSMutableArray alloc] init];
    for (id <MKAnnotation> annot in [mapView annotations]){
        if ( [annot isKindOfClass:[ MKUserLocation class]] ) {
        }
        else {
         

    }
    [mapView removeAnnotations:locs];
    [locs release];
    locs = nil;
 CLLocationCoordinate2D annotationCoord;
    MKCoordinateRegion region;
    MKCoordinateSpan span;
   
    annotationCoord.latitude  = 42.270354;
    annotationCoord.longitude = -88.998159;
  
    span.latitudeDelta = 0.02;
    span.longitudeDelta = 0.02;
   
    region.span = span;
    region.center = annotationCoord;
   
    [mapView setRegion:region animated:YES];
    [mapView regionThatFits:region];
   
   
    MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
    annotationPoint.coordinate = annotationCoord;
    annotationPoint.title=@"Maulik";
    annotationPoint.subtitle=@"keshod,gujarat";
    [mapView addAnnotation:annotationPoint];
    [mapView selectAnnotation:annotationPoint animated:FALSE];

No comments:

Post a Comment