【发布时间】:2016-12-02 07:52:20
【问题描述】:
我已经在 IOS 中实现了谷歌地图。但问题是我无法在我的自定义视图(子视图)上实现谷歌地图。 提前致谢。
【问题讨论】:
标签: ios objective-c google-maps-sdk-ios
我已经在 IOS 中实现了谷歌地图。但问题是我无法在我的自定义视图(子视图)上实现谷歌地图。 提前致谢。
【问题讨论】:
标签: ios objective-c google-maps-sdk-ios
创建子视图并在GMSMapView下定义子视图类
- (void)LoadMap {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
// this line add subView
[self.view addSubview : mapView_ ]; }
【讨论】: