下面是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];
}我的问题是,我的位置按钮没有出现,任何帮助感谢!:)请告诉我,如果你需要看到更多的我的项目。
发布于 2014-07-13 21:08:04
解决了。问题是,我添加了mapview作为一个子视图,而不是出口视图。现在它修好了。
发布于 2016-02-11 07:03:01
得到正确的答案。即使您将mapview添加为子视图,它也会工作。测试和验证了相同的IOS 9.2
_mapView.settings.myLocationButton = YES发布于 2014-07-11 17:55:07
这曾经发生在我身上,为了更简单,我使用了内置在Cocoa中的CoreLocation来获取当前位置,然后使用这些坐标向Google添加一个标记,我希望这会有所帮助。
https://stackoverflow.com/questions/24703229
复制相似问题