iOS how to put MKMapView user location marker over annotations? - ios

In my iOS app i am displaying many, big annotations, and i set user location to be shown as well. My problem is, that my markers are so big, they are covering user's position, so it's hidden very often.
My question is - is there any "normal" way to set user location's marker above all the annotations, or i have to display custom annotation for user's position, or else?

Related

Using MKMapView with a custom MKOverlay. Can the local attractions that come with Apple Maps by default appear above the overlay layer?

I have an MKMapView with an MKOverlay on top, I'm wondering if its possible to have road names, place names, places of interest and everything like that, that comes by default with Apple Maps, can be displayed above my MKMapView so I don't have to add all this information manually as annotations. I know this is possible with the Google Maps API on Android so wasn't sure if I could do this with Apple Maps.
I've added an image that shows iOS versus Android to show what I am envisioning:
So, I've found a solution to this issue. If you're using the addOverlay: method in MKMapView, you can use:
[self.myMapView addOverlay:customOverlay level:MKOverlayLevelAboveRoads];
MKOverlayLevelAboveRoads means place labels including shields and point of interest icons are shown above your overlay.
MKOverlayLevelAboveLabels means your overlay will appear on top of everything (which i believe is the default based on my experiences).

MKMapView default region or copy/duplicate initial state?

After creating a Map View in the storyboard, the default location on the simulator shows up as the United States. Looking from other SO posts, there seems not to be a way to replicate this image since we are not given the default span or region (or any way to access the user's current country and get the corresponding region and span data).
The default map view for the US looks like this:
Is there a way to copy or duplicate the initial state of the map view, so that we can restore it later?
I currently have a "reset" button, but I'm not sure what to reset to. Perhaps make the default region/span the user's current location, if there are no better solutions?

How can I automatically zoom out on MKMapView to the point where the tiles load in iOS?

For my application I have it so my map view zooms in automatically to show about 20km from the users current location on the map (with the user's current location being right in the centre). The problem is that when I test my application on the iPad, for some reason the tiles do not load when it is zoomed in this much. It is only when I zoom out that the tiles will load. I want my application to accomplish the following...
if(tiles do not show when map is zoomed out to default of 20km from user's current location)
zoom out the map until tiles do show
I want this to be taken care of automatically because I don't think it looks good if a user sees unloaded tiles. They may not know that zooming out will show the tiles. Is this possible? Thank you.

Manually show current location blue dot MKMapView ios

I'm building an iPhone app. There is a screen with a map (MKMapView) always showing. But to preserve battery, I don't want user location to be updated all the time, only automatically (every 15 minutes) and manually (onclick).
But, I also want to show this user location on the map.
The problem is, if I showsUserLocation for my MapView, it automatically starts updating location, hence drains battery.
I tried activating the showsUserLocation option, saving the MKUserLocation, then deactivating the showsUserLocation then adding the saved MKUserLocation as an annotation by hand, but it actually shows a WARNING and reactivate the showsUserLocation option !
So I guess the last way is by hand:
I built a blue dot annotation myself but it doesn't have the glowing effect and the accuracy circle around. Do you have any idea how to do this? Or if there is any other way, please share.
Thanks !
well you will have to go with your 'last way' -- MKAnnotationViews can easily be animated -- just treat it like any UIView :) there
see MKMapView current location showing as custom pins for how to mae custom Pins
Just use native flag to enable this like so:
[mapView setShowsUserLocation:YES]
If you want some help on the user location annotation stuff, check out how it's done in MapBox:
http://mapbox.com/mapbox-ios-sdk
In particular you want RMUserLocation. The whole SDK is open source.

iOS - Auto and manual Map routing with user motion and area calculation

I am working on an iOS app whose functionality is to show google map with user current location. I successfully shown user location on map, now I need to draw a route as user moves from current location to another and then to next. Finally at the end on a button click I have to connect very fist location to last location. At the end I need to calculate the drown area in acres.
So I summarize my questions as follows :
How to draw user movement on map?
How to direct connect first and last location on a button click?
How to calculate user moved area?
If I want to draw route from last point to current point on manual click, how to do that?
Please provide any suitable code as well. I would appreciate your efforts.

Resources