Historic question. https://developer.apple.com/documentation/mapkit/mkusertrackingbutton is now available.
When you use the ordinary Map app on ios,
of course you have the blue pointer button, which cycles you through the "tracking" modes. (Show your own location, etc)
MKUserTrackingBarButtonItem does this, but it's a stupid bar button. I don't have a bar and don't want a bar, I have a normal MKMapView.
Can I make the "blue arrow button" simply appear on my MKMapView (nothing to do with a #$@ bar)? Much as in the above image
Or can I just use any old ordinary button, but have it do the same functionality?
Minor - if "B", in fact is there a way to get at that blue-arrow icon?
Just call addMapTrackingButton()
inside viewDidLoad
method:
func addMapTrackingButton(){
let buttonItem = MKUserTrackingButton(mapView: eventsMapView)
buttonItem.frame = CGRect(origin: CGPoint(x:5, y: 25), size: CGSize(width: 35, height: 35))
eventsMapView.addSubview(buttonItem)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With