【问题标题】:Google map load on subviews in IOSIOS中子视图上的谷歌地图加载
【发布时间】:2016-12-02 07:52:20
【问题描述】:

我已经在 IOS 中实现了谷歌地图。但问题是我无法在我的自定义视图(子视图)上实现谷歌地图。 提前致谢。

【问题讨论】:

    标签: ios objective-c google-maps-sdk-ios


    【解决方案1】:

    创建子视图并在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_ ];  }
    

    【讨论】:

      猜你喜欢
      • 2016-04-07
      • 1970-01-01
      • 1970-01-01
      • 2019-09-22
      • 2019-05-30
      • 2015-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多