【问题标题】:Google Maps fill full screen. How to fill it to half screen?谷歌地图填满全屏。如何将其填充到半屏?
【发布时间】:2015-06-29 05:26:27
【问题描述】:

我使用下一个代码:

var camera = GMSCameraPosition.cameraWithLatitude(40.378259,
        longitude: 49.875059, zoom: 16)
    var mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
    mapView.myLocationEnabled = true
    self.view = mapView

    var marker = GMSMarker()
    marker.position = CLLocationCoordinate2DMake(40.378259, 49.875059)
    marker.map = mapView

我使用了约束,但这对我没有帮助。我的地图会全屏显示,即使我执行下一个操作:

var mapView = GMSMapView.mapWithFrame(CGRectMake(0, 0, 100, 100), camera: camera)

为什么它不起作用?我该如何解决?我通过 Podfile 连接它

【问题讨论】:

    标签: ios iphone xcode swift google-maps


    【解决方案1】:

    使用addSubview 方法来做到这一点。

    var mapView = GMSMapView.mapWithFrame(CGRectMake(0, 0, 100, 100), camera: camera)
    mapView.myLocationEnabled = true
    self.view.addSubview(mapView)
    

    【讨论】:

      猜你喜欢
      • 2012-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-03
      相关资源
      最近更新 更多