google maps SDK iOS remove pins with animation - ios

Is there anyway to access GMSMarkers added to GMSMapView? Default .clean() method has no animation of removing object and I want to add some. Or should I override clean()?

So I've solved my problem by storing GMSMarkers in an array and then manipulating with it.

Related

iOS Swift 4 before loading content

I build chat app using Firebase API right now. I wan't to make preload icons like on facebook screenshot. I thought i can create empty images and label fields and fill them after content loaded, but i don't know how to check if all data loaded from DB. How i can do that in correct way?
This is where i want to place objects
Install ListPlaceholder this lib.
import ListPlaceholder
To show the loader, start showing this from start
tableView.showLoader()
To hide the loader, end showing after data has been loaded
tableView.hideLoader()
Please refer this may get help.
https://github.com/malkouz/ListPlaceholder
Facebook has it's own library called Shimmer. To use this on tableview, you can follow this StackOverflow question answer.
You'll just have to create the UIView you want to animate and above that you'll have to add your FBShimmeringView. At the end set shimmeringView.shimmering = true to start shimmering
To hide the loading use tableView.hideLoader()
ListPlaceholder helped me to resolve the issue. All that I did was added the ListLoader.swift file to my project and added tableView.reloadData(), tableView.showLoader() in viewDidAppear in the tableView where I wanted to show loading.
( ListLoader.swif uses visibleCells to determine the number of rows on which the loading should be shown. In my applications, visibleCell's count was incorrect on calling tableView.showLoader() method in viewDidLoad )

GMSPolygon zIndex not working?

Using the latest Google Maps iOS SDK I have a map with overlapping Polygon area's. When trying to tap them, the
- (void) mapView: (GMSMapView *) mapView didTapOverlay: (GMSOverlay *) overlay
function does not loop thru all overlays.
Trying to set the zIndex value to a higher value doesn't seem to make any difference. The value is set, but still I cannot tap the other overlapped overlay..
Anyone has found the same problem? or maybe has another solution?
Was a bug in google maps iOS SDK. Fixed now.

Mapbox custom user location image

I'm using Mapbox 2.1.2 where I need to set a custom image for the user location annotation. This is not a problem to implement both in MapKit or GoogleMaps but how do I deal with this using Mapbox?
If this is not possible, how can I track the user's location? I've already tried to add MGLPointAnnotation objects on location update. But then I have to have a cache of annotations and clear it on adding a new, most recent one which also leads to a "flash" ugly effect.
Background on customizing the user location annotation: https://github.com/mapbox/mapbox-gl-native/issues/2272
The best way to do this right now is to follow the guidance there, which is to customize the MGLUserLocationAnnotation class in the source code (the SDK is open source).
As of Mapbox iOS SDK v3.4.0, you can provide your own user location annotation view that contains a UIImageView. In your MGLMapViewDelegate, implement the -mapView:viewForAnnotation: method to check whether the annotation is equal to the MGLMapView’s userLocation; if so, return a new MGLUserLocationAnnotationView that contains a UIImageView. There’s a work-in-progress example of customizing the user dot in this pull request.

How to remove an arrow from Google Maps geolocation marker (iOS)?

How do you remove an arrow from Google Maps geolocation marker (iOS)?
This is an arrow I'm talking about
If you really want to remove that arrow everywhere in your app from Google Maps SDK, it might be easiest to modify asset in GoogleMaps.framework.
Just navigate (cd) to GoogleMaps.framework/Versions/A/Resources/GoogleMaps.bundle/GMSCoreResources.bundle/ and notice the following files:
GMSSprites-0-1x.png
GMSSprites-0-2x.png
GMSSprites-0-3x.png
If you open these files, you can notice the arrow is there. So just edit directly in the asset by replacing arrow by nothing (transparent pixels).
Note: I haven't test it myself and this is not tested solution, but I believe it should work.
Disclaimer: I'm not sure, but I think this modification might violate Terms & Conditions for using the SDK. I don't get any responsibility for such modification, it's your call...
There is no way to do this with current version of the SDK (1.9.1), and actually there is an open issue with this request: Look here.
As a work around, you can hide the default button with:
_map.myLocationEnabled = NO;
Then create a custom GMSMarker
GMSMarker *pointMarker = [GMSMarker markerWithPosition:currentPosition];
pointMarker.icon = [UIImage imageNamed:#"YourImage"];
pointMarker.map = _map;
And change the position of it using a CLLocationManager, so it always show the current position. It's a bit tricky but is the only way, I could think, that you can achieve this. If you need a more complete example let me know.

Is it possible to create marker with animated icon?

I'm using Google Maps SDK for iOS and I would like to display a marker on my map. I've found out that the class GMSMarker is involved but it only accepts UIImage icon.
I would like the icon to be UIView or CALayer such that its contents could be animated. Is this possible?
I know that if needed, both of the aforementioned UI objects can be rendered into UIImage. However, that's utterly unefficient and ugly code. I would be really happy if there was other way.
Thanks in advance,
Pete.
No, the marker (or overlay) can only display UIImage objects, although they do support animated UIImages (see the AnimatedCurrentLocationViewController in the demo project).

Resources