我的位置按钮未显示在视图中(Google maps SDK,ios)

Jan*_*non 2 google-maps objective-c ios ios7

这是我的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];
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我的位置按钮没有出现,任何帮助赞赏!:)请告诉我你是否需要了解更多我的项目.

Ano*_* VM 9

得到了正确的答案.即使您将mapview添加为子视图,这也会起作用.经过IOS 9.2的测试和验证

_mapView.settings.myLocationButton = YES
Run Code Online (Sandbox Code Playgroud)