I am using google maps in my ios app and I have fixed the marker in the centre of the view so as to get the centre location. Now, while zooming the marker is somewhere else and the current location is somewhere else.what I want to achieve is while zoomingIn or out my location should be in the centre of the map View how can I achieve it. Any help would be great.
Thanks in advance..
You can add this line allowScrollGesturesDuringRotateOrZoom to your GMSMapview. This setting controls whether rotate and zoom gestures can be performed off-center and scrolled around.
mapView.settings.allowScrollGesturesDuringRotateOrZoom = NO
For more information, check this page and this SO question.
If I understood your situation, you have a marker in the center of your map and then you want, in case the user make a Zoom to the map that the marker remain in the center. Well, that is achieved with this logic: You have to listen to the "Zoom changed" event of google map. In case this event is triggered, retrieve the coordinates of the center and recreate the marker with the new coordinates. Doing this in plain javascript is easy, but for what I am seeing now, in IOS could be a little bit more complicated. But, there are some links that I hope could help you:
To detect a Zoom Changed in GoogleMaps SDK IOS:
Is there a Google Map event listener for panning or zooming map?
To get the coordinates from the map center in GoogleMaps SDK IOS:
How to get coordinate center of gmsmapview in iphone
Related
I'm trying to develop an app with a built in navigation feature using Apple Maps. The goal is for it to show the user's current location and rotate to face the direction they are heading in. However, I'd also like it to not view from the top down, more of a tilt, like in Waze.
I can have it follow the user and rotate with the correct heading, etc. using .followWithHeading. But I can't figure out how to have it tilt. I've also tried using a map camera which enables me to tilt it. However, I then can't get the coordinates since I can't use both didUpdateLocation and didUpdateHeading in a single location manager. Any ideas?
I'm using GoogleMaps in iOS to show the merchants location and i successfully placing all markers based on merchants location.
Now my requirement is, i want to show markers count while tapping to zoom out or zoom in as shown below.
Please guide me...
My code was in Objective-C
Looks like you want to cluster the markers. Please check out this link: https://developers.google.com/maps/documentation/ios-sdk/utility/marker-clustering
In the Apple Maps app there is a blue arrow pointing in the direction the phone is facing(marked on the attached screenshot).I can't find how to do the same in my app using MapKit.
I need the map to be facing north and the blue dot with an arrow, just like in the default mode in the apple Maps app.I know I can do this by manually drawing an arrow. But, since it is already implemented in the Maps app, is there a standard setting that allows to achieve this in MapKit?
Currently the only way to achieve this is to create it manually, as Apple does not have any exposed API for it yet.
I posted quite a detailed implementation answer on this post: https://stackoverflow.com/a/40808645/4769084
Basically you need to add your own 'blue arrow icon' to the mapView user location view, then track the device's 'heading' to rotate the 'blue arrow icon' appropriately.
We are working on an app that requires an animation overtop of a map. this is a challenge because the map is a dynamic element and there are obvious limitations to the watch. Does anyone know a way to programatically take a snapshot of the mapview. I figure if we take the screenshot and then create an animation on the phone pushed to the watch this might solve this problem. Open to any other ideas. Thank you!
If you use something other than Apple's mapview you can draw the map yourself and then draw animations over it. Here is an example of where I do this Is it possible to position views on top of each other (the animations in this example transferred too slowly over bluetooth and so I turned them off for the final product). You could look at using something like MapBox (www.mapbox.com) to get map tiles and draw them.
Does the iOS 7.1+ SDK Mapkit offer Map Controls like the one in the image?
... or is this only covered via the gestures?
Are the controls exclusive to the google sdk?
No. MapKit doesn't include controls like the ones illustrated.
MKMapView (the map view in MapKit) typically uses touch gestures to adjust the scale and position of the map. You can pinch in/out to zoom out/in, and you can pan to adjust the displayed area.
There's nothing to prevent you from adding your own controls to a map view if you want to, but given the touch interface it's hard to see why that would be necessary. Indeed, even Google doesn't use those controls in its Google Maps app.