[英]MapView shows max 3 annotations
really strange problem here. 这里真的很奇怪。
I add 4 annotations (or 15, or 20, I've tried a lot of times) and I only get 2 or max 3 of them showing on the map (random ones). 我添加了4个注释(或者,我尝试过很多次,分别是15个或20个),但在地图上(随机显示)最多只能显示2个或最多3个。
here is the source: 这是来源:
// [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);
The log at the end shows 2, or 3. Don't know what to do, simplified the example as much as I could to eliminate other factors, still getting this. 最后的日志显示2或3。不知道该怎么做,我尽可能地简化了示例,以消除其他因素,但仍然可以做到这一点。
As We can see the lat/long of these two are pretty close. 正如我们所看到的,这两个纬度/经度很接近。 I believe all the annotations are plotted on map and you are just not able to see from the current zoomlevel. 我相信所有注释都已绘制在地图上,并且您无法从当前缩放级别看到。
CLLocationCoordinate2D theCoordinate1;
theCoordinate1.latitude = 37.786996;
theCoordinate1.longitude = -122.419281;
CLLocationCoordinate2D theCoordinate4;
theCoordinate4.latitude = 37.80000;
theCoordinate4.longitude = -122.407989;
They seems to be overlapped in mapview in zoomed out view. 它们似乎在缩小视图的地图视图中重叠。 Try zoom-in your map to max level & I believe you will see all 4 annotations. 尝试将地图放大到最大级别,我相信您会看到所有4条注释。
or you can try by changing the lat/long of one of these annotations. 或者您可以尝试更改这些注释之一的纬度/经度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.