Comments (11)
FWIW: you can make markers that were added via the cluster library show their infoWindow. But it seems like you need to set the necessary marker properties before the marker gets rendered.
I was able to make cluster markers show the default info window, when I set their title
or snippet
properties in the willRenderMarker
method of the GMUClusterRendererDelegate
. E.g.:
- (void)renderer:(id<GMUClusterRenderer>)renderer willRenderMarker:(GMSMarker *)marker {
if ([[[marker.userData class] description] isEqualToString:@"POIItem"]) {
POIItem *poiItem = marker.userData;
marker.title = poiItem.name;
marker.icon = [UIImage imageNamed:@"custom_marker_icon"]; // it’s also handy to specify a custom marker icon for all markers
}
}
Please note that this code might not work well for copy-pasting. I only wanted to give a hint on how to achieve showing default infoWindows. Adjust accordingly.
Of course you’d need to conform to the GMUClusterRendererDelegate
protocol and specify the delegate when initialising the renderer
. For example like so:
id<GMUClusterRenderer> renderer = [[GMUDefaultClusterRenderer alloc] initWithMapView:_mapView clusterIconGenerator:iconGenerator];
((GMUDefaultClusterRenderer *)renderer).delegate = self;
from google-maps-ios-utils.
Ok, in combination with willRenderMarker
solution above and returning NO, I managed to show the info window.
from google-maps-ios-utils.
In case anyone is looking for the swift version of the renderer:
func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) {
if let poiItem = marker.userData as? MapClusterItem {
marker.title = poiItem.title
marker.snippet = poiItem.snippet
marker.icon = GMSMarker.markerImage(with: colorAccent)
}
}
MapClusterItem
is your class (in examples the name is POIItem
) and colorAccent
is a UIColor
of your choice.
from google-maps-ios-utils.
We are in the process of pushing out 2.0.0 so stay tuned. Probably sometime next week if everything goes smoothly!
from google-maps-ios-utils.
This is actually a great request and should be on top of our list. Thanks.
from google-maps-ios-utils.
Hi all,
we have committed a solution to this issue here cf73938 but since it's a breaking change we would like to release it in a 2.x.x version (pending other big features we wanted to get in). For now please see the solution in the commit and see if you can work around using it.
from google-maps-ios-utils.
Any update about this issue?
Is there any release date of version 2.x.x?
I am unable to do it using the approach explained before.
from google-maps-ios-utils.
@mountainvat any update on the issue as of now ?
from google-maps-ios-utils.
Hi @hiteshwork , 2.0.0 is out so please update your pod. The clusterManagerDelegate events (https://github.com/googlemaps/google-maps-ios-utils/blob/master/src/Clustering/GMUClusterManager.h#L40) now return a BOOL. Return NO to pass the event to the default handler (i.e showing info window).
Thanks.
from google-maps-ios-utils.
@mountainvat returning NO still doesn't show the info window when tapping on the marker in the cluster. What is the proper way to show the info window then?
from google-maps-ios-utils.
Hello Guys,
delegate methods are not called when I was debug. Anyone know how to resolve this?
id<GMUClusterAlgorithm> algorithm = [[GMUNonHierarchicalDistanceBasedAlgorithm alloc] init];
id<GMUClusterRenderer> renderer = [[GMUDefaultClusterRenderer alloc] initWithMapView:self.mapView clusterIconGenerator:iconGenerator];
((GMUDefaultClusterRenderer *)renderer).delegate = self;
self.clusterManager = [[GMUClusterManager alloc] initWithMap:self.mapView algorithm:algorithm renderer:renderer];
[self.clusterManager cluster];
[self.clusterManager setDelegate:self mapDelegate:self];
[self.clusterRenderer setDelegate:self];
I added code like this.
from google-maps-ios-utils.
Related Issues (20)
- Warning: Error creating LLDB target at path HOT 2
- The automated release is failing 🚨 HOT 1
- snippet-bot full scan
- 4.2.0 version not building cause of missing xframework file HOT 2
- SPM error cannot resolve it. HOT 2
- Clustering: add setter for clusterDistancePoints in the GMUNonHierarchicalDistanceBasedAlgorithm.m HOT 1
- Clustering : Cluster Markers do not initially hide their items on the map HOT 1
- 4.2.2 does not allow updating to latest GoogleMaps (8.x) HOT 7
- TipKit: when adding popover tip to some view on top of GMSMapView tip starts flickering on every map move HOT 1
- Google maps utils compiler error in new Xcode Version 15.0.1 HOT 38
- empty field MinimumOSVersion for internal FB frameworks causes failure on uploading to App Store Connect with Xcode 15.3 HOT 4
- Xcode 15.3 and App store connect issue HOT 2
- Cannot find type 'GMUWeightedLatLng' in scope HOT 2
- I want display multiple cluster images based on markers data HOT 1
- Support App Privacy Manifests HOT 4
- GoogleMaps don't compile at Mac's (is this ever getting fixed?) HOT 1
- Failed to build module 'GoogleMapsUtils Xcode HOT 2
- GMSMapViewDelegate didTapMyLocationButton no zoom HOT 1
- Failed to build module 'GoogleMapsUtils'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK. HOT 2
- Invalid Bundle. The bundle Frameworks/GoogleMapsUtils.framework does not support the minimum OS Version specified in the Info.plist HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-maps-ios-utils.