由于我是新手,对Swift编程和iOS开发都不太熟悉,我在将按钮置于Google地图顶部时遇到了问题。
我一直在使用Cocopods的Google Maps SDK for iOS,并参考了Google Map API指南中的示例。
override func viewDidLoad() {
super.viewDidLoad()
var camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 6)
var mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true;
self.view = mapView
var marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20)
marker.title = "Sydney"
marker.snippet = "Australia"
marker.map = mapView
}
我想把按钮放在地图上方。
![enter image description here](https://istack.dev59.com/vZYh8m.webp)