我继承了一个引发此警告的项目
Incompatible pointer types assigning to 'MKPinAnnotationView *' from 'MKAnnotationView *'
在这条线上
pinView=[[[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:defaultPinID]autorelease];
}
我想在没有警告的情况下退回项目,所以我希望这里有人能快速回答
完整代码:
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation {
MKPinAnnotationView *pinView = nil;
NSUserDefaults *prefs=[NSUserDefaults standardUserDefaults];
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (!pinView) {
pinView=[[[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:defaultPinID]autorelease];
}
}
pinView.animatesDrop=YES;
[mapView.userLocation setTitle:@"I am here"];
[mapView.userLocation setSubtitle:[prefs objectForKey:@"CurrentLocationName"]];
return pinView;
}
谢谢!