3

How do I change the compass location, using swift, on a google map view?

Current answers on Stack Overflow are outdated.

Previous answers here:

How to change myLocationButton position from a GMSMapView?

Moving the google maps compass

I tried this to no avail:

//move position on google compass
    for object in mapView!.subviews {
        if object.theClassName == "GMSUISettingsView" {
            for view in object.subviews {
                if view.theClassName == "GMSx_QTMButton" {
                    var frame = view.frame
                    frame.origin.y = frame.origin.y - 110 // Move the button 110 up
                    view.frame = frame
                }
            }
        }
    }

extension:

extension NSObject {
var theClassName: String {
    return NSStringFromClass(type(of: self))
}

}

newswiftcoder
  • 111
  • 1
  • 11

0 Answers0