MKPointAnnotation* annotation = [[MKPointAnnotation alloc] init];
CLLocationCoordinate2D myCoordinate;
myCoordinate.latitude=latitudeStr.floatValue;
myCoordinate.longitude=longitudeStr.floatValue;
annotation.coordinate = myCoordinate;
[annotation setTitle:[NSString stringWithFormat:@"%@",ad.cellText]];
[_mapView setDelegate:self];
[self.mapView addAnnotation:annotation];
#pragma mark MKMapView delegate
- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id )annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKAnnotationView *annotationView = [_mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
[activityIndicator stopAnimating];
if(annotationView)
return annotationView;
else
{
MKAnnotationView *annotationView = [[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"AnnotationIdentifier"] ;
annotationView.canShowCallout = YES;
annotationView.image =ad.cellImage;
annotationView.draggable = YES;
return annotationView;
}
return nil;
}
CLLocationCoordinate2D myCoordinate;
myCoordinate.latitude=latitudeStr.floatValue;
myCoordinate.longitude=longitudeStr.floatValue;
annotation.coordinate = myCoordinate;
[annotation setTitle:[NSString stringWithFormat:@"%@",ad.cellText]];
[_mapView setDelegate:self];
[self.mapView addAnnotation:annotation];
#pragma mark MKMapView delegate
- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id )annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKAnnotationView *annotationView = [_mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier];
[activityIndicator stopAnimating];
if(annotationView)
return annotationView;
else
{
MKAnnotationView *annotationView = [[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"AnnotationIdentifier"] ;
annotationView.canShowCallout = YES;
annotationView.image =ad.cellImage;
annotationView.draggable = YES;
return annotationView;
}
return nil;
}
Sign up here with your email
ConversionConversion EmoticonEmoticon