Derick Derick - 4 years ago 112
iOS Question

ios mylocationbutton missing on google map

I'm trying to make a slide out navigation app with different views. One such view is the google map. However, when I run the app, the "Google" watermark appears but "My location" button is missing. It's very similar to this post google map sdk ios 7 mylocationbutton disappear but the

self.edgesForExtendedLayout = UIRectEdge.None;
doesn't change anything except give extra blank spaces. Also, it doesn't make sense why the google watermark appears and not the location button.

In
ViewController.swift


override func viewDidLoad() {
super.viewDidLoad()

locationManager.delegate = self
locationManager.requestWhenInUseAuthorization()

mapView.delegate = self

mapView.settings.rotateGestures = false;
mapView.settings.compassButton = true;

}

func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
if status == .AuthorizedWhenInUse {

locationManager.startUpdatingLocation()

mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true
}
}


Any help is greatly appreciated!

Answer Source

So it turns out, the location button was always on the view but the constraints on the map view wasn't set properly so it was not visible.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download