0
ここでは本当に奇妙な問題です。MapViewは最大3つの注釈を表示します
私は4つの注釈(または15、または20、私は何度も試してみました)を追加し、マップ上に2つまたは最大3つしか表示されません(ランダムなもの)。ここ
はソースです:// [self showRealEstates];
CLLocationCoordinate2D theCoordinate1;
theCoordinate1.latitude = 37.786996;
theCoordinate1.longitude = -122.419281;
CLLocationCoordinate2D theCoordinate2;
theCoordinate2.latitude = 37.810000;
theCoordinate2.longitude = -122.477989;
CLLocationCoordinate2D theCoordinate3;
theCoordinate3.latitude = 37.760000;
theCoordinate3.longitude = -122.447989;
CLLocationCoordinate2D theCoordinate4;
theCoordinate4.latitude = 37.80000;
theCoordinate4.longitude = -122.407989;
MapAnnotationRealEstate* myAnnotation1=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate1 andTitle:@"Rohan"];
MapAnnotationRealEstate* myAnnotation2=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate2 andTitle:@"Vaibhav"];
MapAnnotationRealEstate* myAnnotation3=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate3 andTitle:@"Rituraj"];
MapAnnotationRealEstate* myAnnotation4=[[MapAnnotationRealEstate alloc] initWithCoordinate:theCoordinate4 andTitle:@"Sahil"];
NSMutableArray * annotations = [[NSMutableArray alloc] init];
[annotations addObject:myAnnotation1];
[annotations addObject:myAnnotation2];
[annotations addObject:myAnnotation3];
[annotations addObject:myAnnotation4];
[mapView addAnnotations:annotations];
// [mapView addAnnotation:myAnnotation1];
// [mapView addAnnotation:myAnnotation2];
// [mapView addAnnotation:myAnnotation3];
// [mapView addAnnotation:myAnnotation4];
NSLog(@"annotations: %d", [mapView annotations].count);
最後のログはまだなって、他の要因を排除するために同じくらい私ができるように何をするか分からない、例を簡素化する2、または3を示していますこの。
これはかなり近いですが、見た目には十分です。私が地図の中を前後に行くと、私は4つの注釈のうち3つを見ることができますが、必ずしも同じではありません。そして、4つの注釈の間には十分な違いがあります。 – Danail
そして私が言ったように、私はもっと多くの注釈でそれを試しましたが、私はいつもそれらの3つ(ランダム)が表示されます。 – Danail
マップキットデリゲートを扱ったコードを共有してください。 viewForAnnotationなど – samfisher