2016-09-15 93 views
0

我对iOS开发和使用谷歌地图sdk都很新颖。我正在使用Xcode来处理当前的项目。我在适当的地方添加了我的API密钥。如何在Google地图上显示某些内容?

到目前为止,我有这样的:

import UIKit 
import GoogleMaps 
import GooglePlaces 

class MyViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 

    override func loadView() { 
     // Create a GMSCameraPosition that tells the map to display the 
     // coordinate -33.86,151.20 at zoom level 6. 
     let camera = GMSCameraPosition.cameraWithLatitude(36.2108, longitude: -81.6774, zoom: 17.0) 
     let mapView = GMSMapView.mapWithFrame(CGRect.zero, camera: camera) 
     mapView.myLocationEnabled = true 
     self.view = mapView 
    } 

} 

当我建立并使用我的手机运行应用程序,应用程序安装,运行,并显示经纬度,我问它的谷歌地图。我的问题是我如何显示地图上的东西?我想添加一个按钮,在屏幕顶部附近居中显示“开始”。但是当我去Main.storyboard并添加一个按钮它不会出现(大概是因为我的地图已经结束了?)

谢谢!

在故事板视图层次
+0

你不只是使用MapKit的原因吗? –

+0

我不使用的原因是因为我不知道那是哈哈。现在我有一些研究要做 – skyleguy

回答

1

确保后(下)的地图视图按钮进入,也可以如下代码

self.view.bringSubview(toFront: yourButton) 
+0

非常感谢! – skyleguy