my question may seem a bit complicated but let me clarify. i am using mkmapview , in this i want to show current user location with blue dot and circle , but this isn't really exactly what I wanted. As I am making an iPhone application,SInce I am new to map integration its getting difficult for me to do the same.IF any one can provide me a link for its demo or can explain me how to show user location with blue dot with circle on map then it would be of great help to me . Thanks in advance
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Strange error: Can't render polygon
- Can not export audiofiles via “open in:” from Voic
Add this to the top of the viewForAnnotation method:
The special user location annotation is of type MKUserLocation and returning nil in that case tells the map view to draw the default view for it which is the blue dot. and go in MKMapview property and check the show user location....
This is one of properties of MKMapView class. Default value is No, so just set it to YES in your code.
Note that if you add a MapView on to your ViewController in Storyboard, look at the attribute inspector, by default has other annotations checked (Buildings, Points of Interest) on your MapView excepts User Location. It took me a while to find this, it feels like I am playing hide and seek, no sure why it so important to leave this unchecked.
As thexande mentioned, for swift3 you will have to set this to true:
For SWIFT 3
This will allow you to show a blue dot for your user's location in swift 3.
Put this code in the mapView viewFor annotation func
Answer of @Ohmy is correct but in my program the case was different :
From iOS10 you need to add
NSLocationWhenInUseUsageDescription
orNSLocationAlwaysUsageDescription
key in your appInfo.plist
based on your requirement.