【问题标题】:GMSMarker not showing on map after adding添加后 GMSMarker 未在地图上显示
【发布时间】:2019-03-19 12:32:31
【问题描述】:

我正在使用按钮在特定位置添加图钉,我的地图已经加载并显示在屏幕上。然后按下按钮不响应,即使标记创建和分配坐标也是如此。

-(IBAction)addingMarkerOnMap:(id)sender
{
    CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127);
    GMSMarker *london = [GMSMarker markerWithPosition:position];
    london.title = @"London";
    london.icon = [UIImage imageNamed:@"Standard"];
    london.map = self.mapView;

}

【问题讨论】:

    标签: ios objective-c google-maps


    【解决方案1】:

    试试这个代码:

    -(IBAction)addingMarkerOnMap:(id)sender
    {
      dispatch_async(dispatch_get_main_queue(), ^{
        CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5, -0.127);
        GMSMarker *london = [GMSMarker markerWithPosition:position];
        london.title = @"London";
        london.icon = [UIImage imageNamed:@"Standard"];
        london.map = self.mapView;
     });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多