I have tried it both on an actual device (iPad) and the iPhone simulator (ios 4)
I see the map but no Apple headquarters (blue pin) even if I zoom in.
In my OnViewLoad function I have:
mapView = [[MKMapView alloc]开发者_JAVA百科 initWithFrame:self.view.bounds];
mapView.showsUserLocation=TRUE;
mapView.mapType=MKMapTypeHybrid;
[self.view insertSubview:mapView atIndex:0];
In your -mapView:viewForAnnotation:
method, return nil if the annotation is a userLocation object:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
if ([annotation isMemberOfClass:[MKUserLocation class]]) {
return nil;
}
// your normal code
}
This is needed to make sure, the iOS default implementation is used to show the blue userLocation dot.
精彩评论