我想繪製Google Maps for iOS上的標記,並通過包含包含經度和緯度的JSON文件來繪製標記。我可以在代碼中手動執行,通過替換值。 問題是我不知道如何在JSON文件的地圖上顯示新標記。Google地圖上的繪圖標記JSON文件中的iOS
這裏是我的代碼:
- (void)addDefaultMarkers { // Add a custom 'glow' marker around Sydney. GMSMarker *sydneyMarker = [[GMSMarker alloc] init]; sydneyMarker.title = @"Sydney!"; sydneyMarker.icon = [UIImage imageNamed:@"glow-marker"]; sydneyMarker.position = CLLocationCoordinate2DMake(25.062718, 55.130761); sydneyMarker.map = mapView_; GMSMarker *melbourneMarker = [[GMSMarker alloc] init]; melbourneMarker.title = @"Melbourne!"; melbourneMarker.icon = [UIImage imageNamed:@"arrow"]; melbourneMarker.position = CLLocationCoordinate2DMake(25.100822, 55.17467); melbourneMarker.map = mapView_; }
關於如何做到這一點任何想法?
再檢查一下我在這個環節上的問題,http://stackoverflow.com/questions/20902732/how-to-plot-the-markers-in-google-maps-from-a-dictionay-在-IOS。這個鏈接將有助於你獲得 – chandru
嗎? @Al_fareS – chandru
我閱讀了你的文章,而且在我看來,我想對你做同樣的想法,你能告訴我如何解析JSON數據並將其作爲字典收集嗎? 代碼片段將非常有幫助。 –