iphone-MKMapView标注在iOS 4.1的iPhone 4上不显示

| 我对MKMapView有问题。我添加这样的注释:
// set up new points
for(int i = 0; i < [_locations count]; i++) {
    PPlace * place = [_locations objectAtIndex:i];
    PlaceAnnotation * placeAnnotation = [[PlaceAnnotation alloc] initWithPlace:place];
    // if annotation is for currently selected place
    placeAnnotation.isCurrent = i == currentIndexPath.row;
    [self.mapView addAnnotation:placeAnnotation];
    if (placeAnnotation.isCurrent) {
        [self.mapView selectAnnotation:placeAnnotation animated:YES];
    }
    [placeAnnotation release];
}
因此,我尝试在添加标注后立即显示标注,而不是在点击注释图钉之后显示。 在模拟器中,一切正常,在带有iOS 4.3.2的iPhone 3GS上也是如此。但是,标注不会在带有iOS 4.1的iPhone 4上显示(仅在轻按图钉之后显示)。任何想法如何解决这个问题?     
已邀请:
        我的猜测是您没有为注释类的title属性分配值。即使您可以将
canShowCallout
设置为
YES
,除非您的标题中有内容,否则呼出气泡不会显示。     
        尝试添加
placeAnnotation.canShowCallout = YES;
所以看起来像:
// set up new points
for(int i = 0; i < [_locations count]; i++) {
    PPlace * place = [_locations objectAtIndex:i];
    PlaceAnnotation * placeAnnotation = [[PlaceAnnotation alloc] initWithPlace:place];
    // if annotation is for currently selected place
    placeAnnotation.isCurrent = i == currentIndexPath.row;
    [self.mapView addAnnotation:placeAnnotation];
    if (placeAnnotation.isCurrent) {
        [self.mapView selectAnnotation:placeAnnotation animated:YES];
        placeAnnotation.canShowCallout = YES;
    }
    [placeAnnotation release];
}
希望这可以帮助! WeSaM     
        您将需要实现以下方法:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
您可以在这里找到文档     
        您在错误的时间呼叫它。加载后才能选择它。 使用MKMapView的委托方法:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
从该方法内部调用:
[yourMapView selectAnnotation: yourAnnotation animated: YES];
    

要回复问题请先登录注册