Stay organized with collections Save and categorize content based on your preferences.
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 controlsThe 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.
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.
let camera = GMSCameraPosition(latitude: 37.757815, longitude: -122.50764, zoom: 12) let mapView = GMSMapView(frame: .zero, camera: camera) mapView.settings.compassButton = trueObjective-C
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.757815 longitude:-122.50764 zoom:12]; GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView.settings.compassButton = YES;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
.
mapView.settings.myLocationButton = trueObjective-C
mapView.settings.myLocationButton = YES;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
.
mapView.settings.indoorPicker = falseObjective-C
mapView.settings.indoorPicker = NO;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.
Swiftoverride func loadView() { let camera = GMSCameraPosition.camera( withLatitude: 1.285, longitude: 103.848, zoom: 12 ) let mapView = GMSMapView.map(withFrame: .zero, camera: camera) mapView.settings.scrollGestures = false mapView.settings.zoomGestures = false self.view = mapView }Objective-C
- (void)loadView { GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:1.285 longitude:103.848 zoom:12]; GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView.settings.scrollGestures = NO; mapView.settings.zoomGestures = NO; self.view = mapView; }
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[[["This documentation outlines how to customize user interaction with the Google Maps SDK for iOS, focusing on controlling built-in UI components and map gestures."],["Developers can enable or disable UI controls like the compass, My Location button, and floor picker using the `GMSUISettings` class."],["Map gestures such as scrolling, zooming, tilting, and rotating can be individually enabled or disabled through properties of the `GMSUISettings` class."],["Disabling a gesture does not restrict programmatic access to camera settings, only user interaction."],["These customizations provide developers with flexibility to tailor the map experience within their iOS applications."]]],["The Maps SDK for iOS allows customization of user interaction with the map via the `GMSUISettings` class. Built-in UI controls, like the compass, My Location button, and floor picker, can be toggled on or off. The compass is enabled by setting `compassButton` to `YES`, the My Location button with `myLocationButton = YES`, and the floor picker is disabled by `indoorPicker = NO`. Map gestures (scroll, zoom, tilt, rotate) can be enabled or disabled by setting the properties of the same name to `YES` or `NO` respectively.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4