2016-05-03 40 views
0

註解未在地圖上顯示。可能是什麼原因?請help.i不能在地圖上看到的任何引腳或註解,它顯示葡萄牙,西班牙等註釋未在googlemap上顯示

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

你從哪裏把它添加到地圖? 'marker.map = yourMapView;'似乎缺少。 – Larme

+0

我添加了它,但仍然沒有標記。@ Larme –

+0

是否有任何代表用於顯示googlemap或marker? –

回答

0

附近區域,我認爲該標記的座標沒有被正確執行。看看Google's Document中的代碼示例。

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

試着調整你的代碼到這個。

E.g.

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