使用Google Maps SDK Swift创建更小的地图视图 [英] Create smaller map view using Google Maps SDK Swift
问题描述
我想知道是否有人知道如何在Swift中使用他们的SDK编码小型谷歌地图窗口?给出的例子导致占据整个屏幕的视图。我希望我的尺寸更小以允许其他内容。感谢。
I am wondering if anyone knows how to code a smaller window of Google Maps using their SDK in Swift? The examples given result in a view that takes up the entire screen. I want mine to be smaller to allow for other content. Thanks.
http:// i。 stack.imgur.com/6CIGk.png
http:// i。 stack.imgur.com/xSUO3.png
推荐答案
您应该在故事板中创建视图,将它的类设置为GMSMapView,然后为类型为GMSMapView的视图声明IBOutlet我将其命名为myMapView(不要忘记将其链接)然后将此行添加到ViewDidLoad函数内的ViewController中:
You're supposed to create a view in your storyboard and set its class to GMSMapView, then declare an IBOutlet for the view of the type GMSMapView I named it myMapView (dont forget to link it) then you add this lines to your ViewController inside the viewDidLoad function:
let camera = GMSCameraPosition.cameraWithLatitude(4.739001, longitude: -74.059616, zoom: 17)
let myGSMMap = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
myMapView = myGSMMap
这篇关于使用Google Maps SDK Swift创建更小的地图视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!