我在故事板中添加了一个视图,然后将视图设置为GMSMapView。但是现在地图中的位置按钮和指南针缺失。当我使用来自https://developers.google.com/maps/documentation/ios/start#adding_the_google_maps_sdk_for_ios_to_your_project的指令以编程方式添加地图时,地图控件出现。谷歌地图控制丢失
.H类
@interface MapController : UIViewController{
IBOutlet GMSMapView *mapView_;
}
.M类
- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:mapView_.myLocation.coordinate.latitude longitude:mapView_.myLocation.coordinate.longitude zoom:1];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.settings.myLocationButton = YES;
mapView_.settings.compassButton = YES;
}
你为什么需要自我。 – 2014-10-07 12:13:07
哦,太棒了我非常感谢你! @SarathNeeravallil – 2014-10-07 12:15:09