关于ZAKER 融媒体解决方案 合作 加入

ios- 是否有默认按钮用于在 GMSMapView sdk 中显示 .

CocoaChina 11-12

我要添加自定义按钮并添加操作

CLLocationCoordinate2D target=CLLocationCoordinate2DMake ( currentLocation.coordinate.latitude,currentLocation.coordinate.longitude ) ; [ mapView_ animateToLocation:target ] ;

用于将地图移动到当前位置 .SDK 中是否有默认按钮?

最佳答案

是的 , 有一个默认按钮显示地图的当前位置 . 仅当您在 API 中设置 myLocationEnable 时 , 它才可见 .

从文档中

Google Map SDK for iOS

By default, no location data is shown on the map. You may enable the blue "My Location" dot and compass direction by setting myLocationEnabled on GMSMapView.

mapView_.myLocationEnabled = YES;

Enabling this feature will also provide the user ’ s current location through the myLocation property. This property may not be immediately available – for example, if the user is prompted by iOS to allow access to this data. It will be nil in this case.

NSLog ( @"User's location: %@", mapView_.myLocation ) ;

以上内容由"CocoaChina"上传发布 查看原文
相关标签 ios按钮google移动

觉得文章不错,微信扫描分享好友

扫码分享