iOS7 +中的MKMapView标注错误

时间:2014-08-28 14:02:40

标签: ios objective-c mkmapview

只有在我稍微旋转一下地图后,annotationView才会打开标注。否则它只移动地图并仅显示白色三角形 此错误仅存在于iOS7中。在iOS 6中它运行良好 有什么帮助吗?

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
PBAnnotation *pbAnnotation = (PBAnnotation *)annotation;
MKAnnotationView *annotationView = nil;
if (annotation != _mapView.userLocation) {
    static NSString *ReusableViewId = @"PBAnnotation";
    annotationView = (MKAnnotationView *)[_mapView dequeueReusableAnnotationViewWithIdentifier:ReusableViewId];
    if (annotationView == nil) {
        annotationView = [[MKAnnotationView alloc] initWithAnnotation:pbAnnotation reuseIdentifier:ReusableViewId];
        annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        annotationView.canShowCallout = YES;

        switch (pbAnnotation.type) {
            case TypeHotel:
                annotationView.image = [UIImage imageNamed:@"pin-hotel"];
                break;
            case TypeRestaurant:
                annotationView.image = [UIImage imageNamed:@"pin-rest"];
                break;
            case TypeStore:
                annotationView.image = [UIImage imageNamed:@"pin-store"];
                break;
            case TypeTourSite:
                annotationView.image = [UIImage imageNamed:@"pin-site"];
                break;
            default:
                break;
        }

    }
}

return annotationView;
}

enter image description here

enter image description here

0 个答案:

没有答案