Hemanathan
Hemanathan

Reputation: 133

in google map clustering (ios /objective c), changing the cluster icons method not working

I am using google map clusering (https://github.com/googlemaps/google-maps-ios-utils).

There(https://github.com/googlemaps/google-maps-ios-utils/blob/master/app/BasicViewController.m) one of the method to change cluster icons are not working.

- (id<GMUClusterIconGenerator>)iconGeneratorWithImages 
{  
return [[GMUDefaultClusterIconGenerator alloc] initWithBuckets:@[ @10, @50, @100, @200, @1000 ]
                                                backgroundImages:@[
                                                  [UIImage imageNamed:@"m1.png"],
                                                  [UIImage imageNamed:@"m2.png"],
                                                  [UIImage imageNamed:@"m3.png"],
                                                  [UIImage imageNamed:@"m4.png"],
                                                  [UIImage imageNamed:@"m5.png"]
                                                ]];
}

new cluster images will not shown in map. why it is not working? I need to change the cluster icons in map.
Thanks in advance.

Upvotes: 1

Views: 513

Answers (1)

Daniel Pietzsch
Daniel Pietzsch

Reputation: 1389

If I understand correctly you’re trying to make the example code work with custom cluster-marker images.
It seems like that the iconGeneratorWithImages method is never called and hence this returned GMUClusterIconGenerator object is never assigned as the GMUDefaultClusterRenderer’s clusterIconGenerator.

To make it work, I think what you’ll have to do is replace id<GMUClusterIconGenerator> iconGenerator = [self defaultIconGenerator]; in Line 60 with id<GMUClusterIconGenerator> iconGenerator = [self iconGeneratorWithImages];

Upvotes: 1

Related Questions