- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在项目中使用Mapbox SDK。 https://www.mapbox.com/mapbox-ios-sdk/
我已经完成了基本的集群工作,但是我的问题是如何在单击它时进一步分解集群。
例如。我有一个带有8个标记的群集。单击时,它应该进一步放大,不仅是一个级别,而且还可以放大到屏幕上所有8个标记的位置,并可能实现最大缩放(可以将这8个标记中的一些标记聚类)
我试过了
[mapView zoomWithLatitudeLongitudeBoundsSouthWest:CLLocationCoordinate2DMake(南,西)
northEast:CLLocationCoordinate2DMake(北,东),动画:是];
但没有成功。
最佳答案
最终是这样的:
- (void)tapOnAnnotation:(RMAnnotation *)annotation onMap:(RMMapView *)map {
if (annotation.isClusterAnnotation) {
CLLocationCoordinate2D southwestCoordinate = annotation.coordinate;
CLLocationCoordinate2D northeastCoordinate = annotation.coordinate;
for (RMAnnotation *plot in annotation.clusteredAnnotations) {
CGFloat latititude = plot.coordinate.latitude;
CGFloat longitude = plot.coordinate.longitude;
if (southwestCoordinate.latitude > fabsf(latititude)) southwestCoordinate.latitude = latititude;
if (southwestCoordinate.longitude > fabsf(longitude)) southwestCoordinate.longitude = longitude;
if (northeastCoordinate.latitude < fabsf(latititude)) northeastCoordinate.latitude = latititude;
if (northeastCoordinate.longitude < fabsf(longitude)) northeastCoordinate.longitude = longitude;
}
[self.mapView zoomWithLatitudeLongitudeBoundsSouthWest:southwestCoordinate northEast:northeastCoordinate animated:YES];
}
}
southwestCoordinate
和
northeastCoordinate
存储到轻击的批注(在本例中为簇)。然后,对于集群中的每个注释,我们要检查它与该“中心”坐标的绝对距离是否在组中最大。
关于ios - Mapbox如何在单击时解散群集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24261745/
我试图通过 unionSpatialPolygons 溶解内部多边形来生成六边形 map 的轮廓。或 aggregate职能。我得到了不溶解的杂散十六进制......一个显示问题的虚拟示例: # gr
我使用 AVPlayerViewController 在我的应用中播放短视频。 如果在用户在我的应用中播放视频之前有一个应用在后台播放音频,我希望在我的视频播放器关闭后恢复另一个应用的后台音频播放。我
我有三个 Controller 与 segues 相连。 Controller 一是 MyNotif, Controller 二是 AddNotif, Controller 三是 SelectInte
在我学习 Swift 3 和 Xcode 8 的过程中,我现在感到困惑或不知道何时使用正确的切换方法。要取消你解雇,返回你回去但后退按钮可以解雇吗? 哪一个是内存使用方面的最佳实践? @IBActio
我一直在尝试使用 Storyboards 关闭模态,但从阅读旧的 beta 版本来看,这些模态似乎已损坏。我尝试添加 header 以允许我从 Obj-C 端放松,但仍然没有。 这是我的swift文件
我是一名优秀的程序员,十分优秀!