GMSMapView
とGMSCameraPosition
-(void)setup {
GMSCameraPosition *camera =
[GMSCameraPosition cameraWithLatitude:71.00
longitude:45.124
zoom:14
bearing:0
viewingAngle:0];
self.mapView = [GMSMapView mapWithFrame:CGRectMake() camera:camera];
self.mapView.delegate = self;
self.mapView.mapType = kGMSTypeNormal;
//current location on map
self.mapView.myLocationEnabled = YES;
//map controls
self.mapView.settings.compassButton = YES;
self.mapView.settings.myLocationButton = YES;
//constraining the zoom options
[self.mapView setMinZoom:10 maxZoom:18];
[self.view addSubview:self.mapView];
}
が地図上multiple pins
をplotingため、このメソッドを呼び出しセットアップ。
-(void)plotMutliplePinsOnMap:(NSArray *)mapArray
{
for(int i=0;i<[mapArray count];i++)
{
double_lat = [[[mapArray objectAtIndex:i]valueForKey:@"latitude"] doubleValue];
double_long = [[[mapArray objectAtIndex:i]valueForKey:@"longitude"] doubleValue];
GMSMarker *mkr = [[GMSMarker alloc] init];
mkr.icon = [UIImage imageNamed:@"map_black"];
if (double_lat !=0 && double_long!=0)
{
[mkr setPosition:CLLocationCoordinate2DMake(double_lat, double_long)];
[mkr setTitle:[[mapArray objectAtIndex:i] valueForKey:@"placeName"]];
[mkr setSnippet:[[mapArray objectAtIndex:i] valueForKey:@"address"]];
[mkr setMap:self.mapView];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:double_lat longitude:double_long zoom:5];
self.mapView.camera=camera;
}
}
}
https://stackoverflow.com/questions/16191436/adding-multiple-pins-on-google-map-in-ios – Pipiks
チェックURL https://stackoverflow.com/questions/27163318/how- to-show-multiple-annotation-in-mkmapview-ios –
次の行は必須ですか?[mkr setTitle: