高德地图聚合

使用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:聚合不太灵敏

转载于:https://www.cnblogs.com/tufei7/p/5191950.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值