在ios上的谷歌地图上添加多个引脚
我想在谷歌地图上添加多个引脚,同时加载它。
我有附近位置的纬度和经度值列表。 如何使用别针在地图上显示所有这些位置。 我正在使用适用于iOS的Google SDK。
我使用以下代码,但它对我不起作用。
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"12.981902,80.266333",@"12.982902,80.266363", nil]; CLLocationCoordinate2D pointsToUse[5]; for (int i = 0; i < [array Size]; i++) { pointsToUse[i] = CLLocationCoordinate2DMake([[[[array objectAtIndex:0] componentsSeparatedByString:@","] objectAtIndex:0] floatValue],[[[[array objectAtIndex:0] componentsSeparatedByString:@","] objectAtIndex:1] floatValue]); [array removeObjectAtIndex:0]; GMSMarkerOptions *options = [[GMSMarkerOptions alloc] init]; options.position = pointsToUse[i]; [mapView_ animateToLocation:pointsToUse[i]]; [mapView_ addMarkerWithOptions:options]; }
我已经尝试了足够的搜索,但没有足够的文档来回答我的问题。
先谢谢您的帮助。
这对我有用:
for(GMSMarker*marker in array) { GMSMarker *mkr= [[GMSMarker alloc]init]; [mkr setPosition:CLLocationCoordinate2DMake()]; [mkr setAnimated:YES]; [mkr setTitle:]; [mkr setSnippet:]; [mkr setMap:mapView_]; }
使用最新的Google Maps SDK。
希望能帮助到你
self.view = mapView_; for(int i=0;i<[array count];i++) { GMSMarker *marker = [[GMSMarker alloc] init]; marker.animated=YES; marker.position = CLLocationCoordinate2DMake(latitude,longitude); marker.title = @"name"; marker.snippet = @"snippet"; marker.map = mapView_; }
这对我有用!
对于swift,我们可以使用
for i in 0..
- 在为UICollectionViewCell设置动画时,bounds.size和frame.size之间的相关性是什么
- 如何隐藏工具栏在新的iOS?
- UIView addSubview自动布局不工作
- 获得客户端证书使用Swift 3和Alamofire 4进行相互authentication
- 无法在UITableView中selectCell对于UITableViewCellAccessoryCheckmark
- facebook sdk在应用程序委托中崩溃
- iOS 8的自我大小单元不适用于UITableViewCellStyleSubtitle和numberOfLines = 0?
- 有什么指导iOS的runloop机制?
- 在应用程序购买不工作