
Untitled
By: a guest on
Jul 14th, 2012 | syntax:
None | size: 1.56 KB | hits: 16 | expires: Never
MKPinAnnotationView versus MKAnnotationView
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;
}
pinView=[[[MKAnnotationView alloc]initWithAnnotation...
pinView=[[[MKPinAnnotationView alloc]initWithAnnotation...
else
pinView.annotation = annotation;
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation {
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (!pinView) {
pinView=[[[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:defaultPinID]autorelease];
}
..........
..........
}