2016-09-15 94 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