简体   繁体   中英

Change Map Type through UIButton Toggle - Google Maps iOS SDK

How can I switch between the standard Map view to the Satellite Map View using a UIButton to act as a toggle? Using Google Maps iOS SDK.

You can use:

private var mapView: GMSMapView!

mapView.mapType = .satellite

You can replace "satellite" with other map types.

You can make a button and give it a function, something like this:

private func buttonClick() {
    switch mapView.mapType {
    case .satellite:
        mapView.mapType = .normal
    default:
        mapView.mapType = .satellite
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM