Tag: 歌地图

适用于iOS的Google Maps API myLocationEnabled无效

我正尝试使用Google Maps API,但无法获取用户的位置信息。 观察值似乎永远不会改变,因为observeValueForKeyPath永远不会被调用。 注意:我正在运行Xcode6-Beta 5和iOS8 beta(代码是在Swift中) override func viewDidLoad() { super.viewDidLoad() var camera:GMSCameraPosition? = nil mapView_ = GMSMapView.mapWithFrame(CGRectZero, camera:camera); mapView_!.addObserver(self, forKeyPath: "myLocation", options: NSKeyValueObservingOptions.fromRaw(0x01)!, context: nil); camera = GMSCameraPosition.cameraWithTarget(mapView_!.myLocation.coordinate, zoom: 6); mapView_!.camera = camera; self.view = mapView_; dispatch_async(dispatch_get_main_queue(), { mapView_!.myLocationEnabled = true; }); } override func observeValueForKeyPath(keyPath: String!, ofObject object: AnyObject!, change: [NSObject : […]

iOS:Google Maps API – markerInfoWindow vs markerInfoContents

我查看了Google地图文档 ,说明似乎没有多大帮助。 我正在使用一个使用markerInfoContents的旧教程 ,但是,当我使用委托它没有返回我所期望的。 使用markerInfoContents :我的自定义视图似乎覆盖默认视图 当我使用markerInfoWindow ,结果是我所期望的: 我只是简单地从一个xib文件拉入一个自定义的UIView像这样: func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? { let placeMarker = marker as! PlaceMarker print(placeMarker.name) if let infoView = UIView.viewFromNibName(name: "MarkerInfoView") as? MarkerInfoView { infoView.nameLabel.text = placeMarker.name return infoView } else { return nil } } (将markerInfoWindowreplace为第一个图像结果的markerInfoContents ) 使用markerInfoContents创build框的锚点和阴影效果。 当使用markerInfoWindow它不会像本教程中那样创build锚或阴影效果。 任何帮助将是伟大的!