默认用户注释(蓝色大理石下降)必须显示第二个用户的拉动位置,以便用户可以获得第二个用户的位置不是静态的,而是在移动中。Pin Annotation类建议该位置是静态的。
我怎样才能做到这一点呢?
发布于 2012-10-18 17:32:29
-(void)updateLocation
{// this will update your location
NSString *latitude = @"0.0";
NSString *longitude=@"0.0";
MyAnnotation *ann = [[MyAnnotation alloc] initWithLatitude:latitude Longitude:longitude];
[self.theMapView removeAnnotations:[self.theMapView annotations]];
[self.theMapView performSelectorOnMainThread:@selector(addAnnotation:) withObject:ann waitUntilDone:YES];
MKCoordinateRegion region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.1f, 0.1f));
[self.theMapView setRegion:region];
}
- (MKAnnotationView *) mapView:(MKMapView *)mapView1 viewForAnnotation:(id <MKAnnotation>) annotation{
// if it's the user location, just return nil.
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
// try to dequeue an existing pin view first
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKAnnotationView *pinView = [[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
pinView.image = [UIImage imageNamed:@"BlueMarbleDrop"];
pinView.annotation = annotation;
return pinView;
}

https://stackoverflow.com/questions/12950326
复制相似问题