【发布时间】:2014-03-04 13:40:15
【问题描述】:
我正在使用谷歌地图。第一次添加引脚,当位置改变时,引脚被第一个最后一个覆盖。我想在每次更改位置时在位置上添加新的引脚。 所以任何人都可以帮助我。
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
location_updated = [locations lastObject];
NSLog(@"updated coordinate are %@",location_updated);
latitude1 = location_updated.coordinate.latitude;
longitude1 = location_updated.coordinate.longitude;
NSLog(@"%f,%f",latitude1, longitude1);
self.lblLat.text = [NSString stringWithFormat:@"%f",latitude1];
self.lblLon.text = [NSString stringWithFormat:@"%f",longitude1];
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&sensor=false",latitude1,longitude1]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
connection = [NSURLConnection connectionWithRequest:request delegate:self];
if (connection)
{
webData1 = [[NSMutableData alloc]init];
}
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(latitude1,longitude1);
marker.title = @"Ahmedabad";
marker.snippet = @"India";
marker.icon = [UIImage imageNamed:@"m2.png"];
marker.map = mapView_;
}
【问题讨论】:
标签: ios iphone google-maps