2015-05-21 211 views
4

在谷歌地圖iOS應用我覺得像這樣的位置按鈕時它不挖掘當前位置 Before tapping谷歌地圖myLocation按鈕顏色 - IOS

敲擊myLocation按鈕後就是這個樣子(藍色)。位置button.not點。 After getting current location

如何,我可以在我的iOS應用程序使這個?請幫助 想這blue tint現在這個gray tint 之後和之前查找當前位置

+0

呈現按鈕的圖像並相應地更改色調顏色 –

+0

此按鈕沒有色調或顏色屬性 self.googleMapView.settings.myLocationButton。 – Sofeda

回答

0

首先,你使用下面的代碼讓你的當前位置 -

CLLocationCoordinate2D myLocation = self.mapView.myLocation.coordinate; 

然後你可以使用GMSMarker與圖像指向您的當前位置或顏色

GMSMarker *marker = [[GMSMarker alloc] init]; 
    marker.position = CLLocationCoordinate2DMake(-33.86, 151.20); 
    marker.title = @"Sydney"; 
    marker.snippet = @"Australia"; 
    // marker.icon = [GMSMarker markerImageWithColor:[UIColor redColor]]; 
    marker.icon = [UIImage imageNamed:@"point1.png"]; 
    marker.map = self.mapView; 

希望上面的代碼將幫助你。

+0

不.i不想在我目前的位置上設置標記。我只是想在我的應用程序中使用谷歌地圖ios應用程序的上述功能。當它找到當前位置時的位置按鈕顏色就像Google地圖應用程序一樣。 – Sofeda

+0

請添加[mapView_ addObserver:self forKeyPath:@「myLocation」 options:NSKeyValueObservingOptionNew context:NULL]; 然後調用self.mapView.settings.myLocationButton = YES;在 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context –

+0

不工作。點擊myLocation按鈕動畫攝像頭到當前位置,但myLocation按鈕顏色與之前相同。 – Sofeda