我的位置button没有出现在视图中(Google maps SDK,ios)

这是我的mapViewController.m文件:

@interface MapViewController() @property (strong, nonatomic) GMSMapView* mapView; @property (weak, nonatomic) IBOutlet GMSMapView *subView; @end @implementation MapViewController - (void) viewDidLoad{ // Create a GMSCameraPosition that tells the map to display the // coordinate -33.86,151.20 at zoom level 6. GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6]; _mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera]; _mapView.myLocationEnabled = YES; _mapView.settings.compassButton = YES; _mapView.settings.myLocationButton = YES; [self.subView addSubview:_mapView]; } 

我的问题是,我的位置button不出现,任何帮助赞赏! :)请告诉我,如果你需要看到我的项目更多。

得到了正确的答案。 即使您将mapview作为子视图添加,也是如此。 testing和validation相同的IOS 9.2

 _mapView.settings.myLocationButton = YES 

解决了它。 问题是我添加了mapview作为子视图,而不是出口视图。 现在是固定的。

它发生在我身上一次,为了使它更容易,我使用内置于Cocoa Touch中的CoreLocation获取当前位置,然后使用这些坐标为Google Map添加一个标记,我希望这会有所帮助。