You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Maps SDK for iOS

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Maps SDK for iOS
  3. Create appropriate keys
Continue

Controls and Gestures

Using the Google 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 Google 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.

Compass

The Google 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

let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.settings.compassButton = true

Objective-C

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 currently known. You can enable the button by setting the myLocationButton property of GMSUISettings to YES.

Swift

let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.settings.myLocationButton = true

Objective-C

GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
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.

Swift

let mapView = GMSMapView.map(withFrame: .zero, camera: camera)
mapView.settings.indoorPicker = true

Objective-C

GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
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 will not 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

override 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;
}

Send feedback about...

Google Maps SDK for iOS
Google Maps SDK for iOS
Need help? Visit our support page.