2016-05-03 12 views
0

Anmerkungen werden nicht auf der Karte angezeigt. Was könnte der Grund sein? pls help.I kann keine Pin oder Anmerkungen auf der Karte sehen, es zeigt Gebiet in der Nähe von Portugal, Spanien usw.Anmerkungen werden nicht auf googlemap angezeigt

addressArray = dictionary[@"data"][@"centers"]; 
NSArray *latitude =[dictionary[@"data"][@"centers"]valueForKey:@"lat"]; 
NSArray *longitude=[dictionary[@"data"][@"centers"]valueForKey:@"lng"]; 
NSString *cname=[dictionary[@"data"][@"centers"]valueForKey:@"category_name"]; 
loaderView.hidden = true; 
NSLog(@"%@",latitude); 
NSLog(@"%@",longitude); 
NSLog(@"%@",cname); 
UIImage *pinImage = [UIImage imageNamed:@"map_gym"]; 
GMSMarker *mark=[[GMSMarker alloc]init]; 
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[latitude objectAtIndex:0] doubleValue] ,[[longitude objectAtIndex:0] doubleValue]); 
NSLog(@"%@",[latitude objectAtIndex:0]); 
NSLog(@"%@",[longitude objectAtIndex:0]); 
mark.position =coord; 
mark.title=cname; 
mark.icon=pinImage; 
mark.infoWindowAnchor = CGPointMake(0.5, 0.25); 
mark.groundAnchor = CGPointMake(0.5, 1.0); 
mark.map=_mapView; 
+0

Wo haben Sie es zur Karte hinzugefügt? 'marker.map = yourMapView;' scheint zu fehlen. – Larme

+0

ich habe es hinzugefügt, aber immer noch keine Markierung ist da. @ Larme –

+0

Gibt es Delegate verwendet, um googlemap oder Marker anzuzeigen ??? –

Antwort

0

Ich denke, die Koordinaten des Markers ist nicht richtig implementiert. Schauen Sie sich das Codebeispiel in Google's Document an.

CLLocationCoordinate2D position = CLLocationCoordinate2DMake(10, 10); 
GMSMarker *marker = [GMSMarker markerWithPosition:position]; 
marker.title = @"Hello World"; 
marker.map = mapView_; 

Versuchen Sie, Ihren Code zu diesem anzupassen.

z.

CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[latitude objectAtIndex:0] doubleValue] ,[[longitude objectAtIndex:0] doubleValue]); 
GMSMarker *marker = [GMSMarker markerWithPosition:coord]; 
marker.title = @"Hello World"; 
    marker.map = mapView_; 
Verwandte Themen