高德地图聚合
使用git做版本控制
步骤如下:
下载,拖进来.a
拷贝算法文件
拷贝SDDemandListViewController
根据报错修改相应文件
添加方法 makeContent
添加属性@property (nonatomic, strong) NSNumber *category; //任务分类 sven添加
拖进来图片资源搞定
------------------------------------------------------------------------
bug
---------------------------------------------------------------------------
高德地图聚合
- (void)mapView:(MAMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
// We add a new operation queue to do the clustering
[[NSOperationQueue new] addOperationWithBlock:^{
double scale = self.mapView.bounds.size.width / self.mapView.visibleMapRect.size.width;
NSArray *annotations = [self.clusteringManager clusteredAnnotationsWithinMapRect:mapView.visibleMapRect withZoomScale:scale];
// The clusteringManager will get the main queue to do the UI stuff.
[self.clusteringManager displayAnnotations:annotations onMapView:mapView];
}];
} // 加上之后不显示大头针了,annotations为空
------------------------------------------------------------------------------------------------------------
点击任务详情崩溃
添加下面代码就好了
SDResourceQueryMode *content = [self.contentData objectAtIndex:[annotation.title integerValue]];
[annotationView makeContent:content WithCustomAnnotationViewClick:^(NSString *resourceID) {
NSString *userID = [NSString stringWithFormat:@"%@",content.mUserId];
SDDemandReceiveViewController *demandDetail = \
[[SDDemandReceiveViewController alloc] initWithResourceID:resourceID WithUserID:userID];
demandDetail.forwardVC = @"mainOrTask";
[self.navigationController pushViewController:demandDetail animated:YES];
}];
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------
// 下面的方法不调用
NSArray *annotations = [self.clusteringManager clusteredAnnotationsWithinMapRect:mapView.visibleMapRect withZoomScale:1]; // 没有获取到大头针 scale
NSLog(@"annotations.count%td",annotations.count); // 不调用这个方法
---------------------------------------------------------------------------------------------------------
双击就行了
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
点击图片跳转到弹出黑色view
------------------------------------------------------------------------------------------------------------------------
点击图片不能弹出黑色View
点击后方法不走,被拦截了? 初始化的时候加上手势就不行了 在适当的位置加下面的代码
self.portraitImageView.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(jump)];
[self.portraitImageView addGestureRecognizer:tap];
return;
你是如何知道在哪里加这些代码的? 注释掉一部分,再打开一部分
第一次点击没有跳转,第二次点击才跳转,在设置下标数字的时候添加手势
- (void)setCount:(NSUInteger)count
{
_count = count;
self.clusterLbl.backgroundColor = [UIColor redColor];
self.clusterLbl.text = [@(_count) stringValue];
self.clusterLbl.textAlignment = NSTextAlignmentCenter;
self.clusterLbl.font = [UIFont systemFontOfSize:15];
self.clusterLbl.textColor = [UIColor whiteColor];
self.portraitImageView.userInteractionEnabled = YES;
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(jump)];
[self.portraitImageView addGestureRecognizer:tap];
}
----------------------------
拿不到数组,写懒加载就行了,如果不为空直接走掉.打断点,看数组元素的个数,发现的
----------------------------
图片崩溃,数组内容不对,没有获取到正确的模型
如何知道是哪几个聚合了,拿不到模型
如何拿到聚合后的模型
可以知道聚合后的模型数量,如何获得contentData 搞定
for ( MAPointAnnotation *pointAnnotation in ((MAAnnotationCluster *)annotation).annotations) {
SDResourceQueryMode *content = [self.contentData objectAtIndex:pointAnnotation.title.intValue];
[contentArr addObject:content];
}
------------------------------------------------------------------------------------
点击cell push到新控制器
------------------------------------------------------------------------------------
Bug:聚合不太灵敏
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?