<br />

Select platform: [Android](https://developers.google.com/maps/documentation/android-sdk/controls.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/ios-sdk/controls.md.txt "View this page for the iOS platform docs.") [JavaScript](https://developers.google.com/maps/documentation/javascript/controls.md.txt "View this page for the JavaScript platform docs.")

<br />

Using the Maps SDK for iOS, you can customize the way in which users
interact with your map, by determining which of the built in UI components
appear on the map and which gestures are allowed.

## Map controls

The Maps SDK for iOS provides some built-in UI controls that are
similar to those found in the Google Maps for iOS application. You can
toggle the visibility of these controls using the `GMSUISettings` class.
Changes made on this class are immediately reflected on the map.

> [!NOTE]
> **Note:** Each control has a predetermined position relative to the edge of the map. You can move the controls away from the edges by [padding](https://developers.google.com/maps/documentation/ios-sdk/map.md.txt#map_padding) the map.

### Compass

The Maps SDK for iOS provides a compass graphic which appears in the
top right corner of the map under certain circumstances. The compass will only
appear when the camera is oriented such that it has a non-zero bearing. When the
user clicks on the compass, the camera animates back to a position with bearing
of zero (the default orientation) and the compass fades away shortly afterwards.

The compass is disabled by default. You can enable the compass by setting the
`compassButton` property of `GMSUISettings` to `YES`. However, you cannot
force the compass to always be shown.


### Swift

```swift
let camera = GMSCameraPosition(latitude: 37.757815, longitude: -122.50764, zoom: 12)
let options = GMSMapViewOptions()
options.camera = camera
let mapView = GMSMapView(options: options)
mapView.settings.compassButton = true
      
```

### Objective-C

```objective-c
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.757815
                                                        longitude:-122.50764
                                                             zoom:12];
GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init];
options.camera = camera;
GMSMapView *mapView = [[GMSMapView alloc] initWithOptions:options];
mapView.settings.compassButton = YES;
      
```

<br />

### My Location button

The My Location button appears in the bottom right corner of the screen *only*
when the My Location button is enabled. When a user clicks the button, the
camera animates to focus on the user's current location if the user's location
is known. You can enable the button by setting the
`myLocationButton` property of `GMSUISettings` to `YES`.


### Swift

```swift
mapView.settings.myLocationButton = true
      
```

### Objective-C

```objective-c
mapView.settings.myLocationButton = YES;
      
```

<br />

### Floor picker

The floor picker control appears near the bottom right of the screen whenever an
indoor map is featured prominently. When two or more indoor maps are visible the
floor picker relates to the building nearest to the center of the screen. Each
building has a default floor which is selected when the picker is first
displayed. You can choose a different floor by selecting it from the picker.

You can disable the floor picker control by setting the `indoorPicker` property
of `GMSUISettings` to `NO`.


### Swift

```swift
mapView.settings.indoorPicker = false
      
```

### Objective-C

```objective-c
mapView.settings.indoorPicker = NO;
      
```

<br />

## Map gestures

You can disable the default gestures on the map by setting properties of the
`GMSUISettings` class, which is available as a property of the `GMSMapView`.
The following gestures can be enabled and disabled programmatically. Note that
disabling the gesture won't limit programmatic access to the camera
settings.

- `scrollGestures` --- controls whether scroll gestures are enabled or disabled. If enabled, users may swipe to pan the camera.
- `zoomGestures` --- controls whether zoom gestures are enabled or disabled. If enabled, users may double tap, two-finger tap, or pinch to zoom the camera. Note that double tapping or pinching when `scrollGestures` are enabled may pan the camera to the specified point.
- `tiltGestures` --- controls whether tilt gestures are enabled or disabled. If enabled, users may use a two-finger vertical down or up swipe to tilt the camera.
- `rotateGestures` --- controls whether rotate gestures are enabled or disabled. If enabled, users may use a two-finger rotate gesture to rotate the camera.

In the example below, both pan and zoom gestures have been disabled.


### Swift

```swift
override func loadView() {
  let camera = GMSCameraPosition.camera(
    withLatitude: 1.285,
    longitude: 103.848,
    zoom: 12
  )

  let options = GMSMapViewOptions()
  options.camera = camera
  let mapView = GMSMapView(options: options)
  mapView.settings.scrollGestures = false
  mapView.settings.zoomGestures = false
  self.view = mapView
}
      
```

### Objective-C

```objective-c
- (void)loadView {
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285
                                                          longitude:103.848
                                                               zoom:12];
  GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init];
  options.camera = camera;
  GMSMapView *mapView = [[GMSMapView alloc] initWithOptions:options];
  mapView.settings.scrollGestures = NO;
  mapView.settings.zoomGestures = NO;
  self.view = mapView;
}
      
```

<br />