0

I thought it had to be easy...but

So I have GMSMapView,

mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true

I don't know how custom location button.

I found a solution how to change the position of the button

for (UIView *object in mapView.subviews) {
        if([[[object class] description] isEqualToString:@"GMSUISettingsView"] )
        {
            for(UIView *view in object.subviews) {
                if([[[view class] description] isEqualToString:@"GMSx_QTMButton"] ) {
                    CGRect frame = view.frame;
                    frame.origin.y = 0.0;
                    view.frame = frame;
                }
            }
        }
    } 

source: Change my location button position in google map ios

I think this method will be possible to change the button image, but I do not know how to do it using Swift.

Thanks for help!

Community
  • 1
  • 1
Mikhail Sein
  • 329
  • 3
  • 4
  • 14
  • you can use [GMSMarker](https://developers.google.com/maps/documentation/ios-sdk/marker) and it has property for custom image... – Mazel Tov Jul 30 '16 at 17:07
  • maybe I put it correctly, I want to change the image of this button. not a blue dot. https://i.gyazo.com/34ce627c5014219250471a140220187b.png – Mikhail Sein Jul 31 '16 at 08:54
  • in that case I think it is easier create generic iOS button and set custom image to it and create the function that redirects the camera position to your current location for that button by yourself... – Mazel Tov Jul 31 '16 at 10:23

0 Answers0