Reputation: 145
I am trying to display a button on top of my Google Map View on iOS. I am using Xcode and have tried the following code:
let mapView = GMSMapView()
override func loadView(){
view = mapView
do{
if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json"){
mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
}
} catch {
}
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: 45.45, longitude: -73.6)
marker.title = "Montreal"
marker.snippet = "Canada"
marker.map = mapView
onMapReady()
}
I do not see any button when the map loads. This is what the storyboard looks like:
Here are the constraints: enter image description here
How would I get this button to appear?
Upvotes: 2
Views: 2054
Reputation: 10105
In case you have added your button inside the Parent View you can manage the constraints like:
Instead, if the button is outside and above your Parent View you can use this:
Upvotes: 1