gpt4 book ai didi

ios - 如何在 Objective-C(iOS) 的 `Google Maps` View 中添加标记

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:02:41 25 4
gpt4 key购买 nike

我正在尝试从我的网络服务中的数据向 Google map 添加标记。现在如何显示仅在“特定半径距离”中的标记。我正在尝试,但没有关于如何在 Objective-C 中实现它的逻辑。

最佳答案

它对我有用。请尝试一下。

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:(sourceValue.latValue + destinationValue.latValue)/2
longitude:(sourceValue.lngValue + destinationValue.lngValue)/2
zoom:7.5];

mapview = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
[self.view addSubview:mapview];
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(sourceValue.latValue, sourceValue.lngValue);
marker.map = mapview;

//Place source mark of destination

GMSMarker *marker2 = [[GMSMarker alloc] init];
marker2.position = CLLocationCoordinate2DMake(destinationValue.latValue, destinationValue.lngValue);
marker2.map = mapview;

根据您的要求更改您的经纬度值。谢谢

关于ios - 如何在 Objective-C(iOS) 的 `Google Maps` View 中添加标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40834861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com