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

时间:2014-07-11 17:23:04

标签: ios objective-c google-maps 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];
}

我的问题是我的位置按钮没有显示,任何帮助表示赞赏! :) 如果您需要查看我的更多项目,请告诉我。

3 个答案:

答案 0 :(得分:9)

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

alter table alerts_account add index idx_alert_id(alert_id), add index idx_account_id(account_id);

答案 1 :(得分:4)

解决了它。问题是我将mapview添加为子视图,而不是插件视图。现在已修复。

答案 2 :(得分:0)

它曾经发生在我身上,为了方便起见,我使用了Cocoa Touch中内置的CoreLocation来获取当前位置,然后使用这些坐标为Google Map添加标记,我希望这会帮助