GoogleNavigation Framework Reference

GMSCameraUpdate

@interface GMSCameraUpdate : NSObject

GMSCameraUpdate represents an update that may be applied to a GMSMapView.

It encapsulates some logic for modifying the current camera.

It should only be constructed using the factory helper methods below.

  • Returns a GMSCameraUpdate that zooms in on the map.

    The zoom increment is 1.0.

    Declaration

    Swift

    class func zoomIn() -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)zoomIn;
  • Returns a GMSCameraUpdate that zooms out on the map.

    The zoom increment is -1.0.

    Declaration

    Swift

    class func zoomOut() -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)zoomOut;
  • Returns a GMSCameraUpdate that changes the zoom by the specified amount.

    Declaration

    Swift

    class func zoom(by delta: Float) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)zoomBy:(float)delta;
  • Returns a GMSCameraUpdate that sets the zoom to the specified amount.

    Declaration

    Swift

    class func zoom(to zoom: Float) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)zoomTo:(float)zoom;
  • Returns a GMSCameraUpdate that sets the camera target to the specified coordinate.

    Declaration

    Swift

    class func setTarget(_ target: CLLocationCoordinate2D) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)setTarget:(CLLocationCoordinate2D)target;
  • Returns a GMSCameraUpdate that sets the camera target and zoom to the specified values.

    Declaration

    Swift

    class func setTarget(_ target: CLLocationCoordinate2D, zoom: Float) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)setTarget:(CLLocationCoordinate2D)target
                                      zoom:(float)zoom;
  • Returns a GMSCameraUpdate that sets the camera to the specified GMSCameraPosition.

    Declaration

    Swift

    class func setCamera(_ camera: GMSCameraPosition) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)setCamera:(nonnull GMSCameraPosition *)camera;
  • Returns a GMSCameraUpdate that transforms the camera such that the specified bounds are centered on screen at the greatest possible zoom level. The bounds will have a default padding of 64 points.

    The returned camera update will set the camera’s bearing and tilt to their default zero values (i.e., facing north and looking directly at the Earth).

    Declaration

    Swift

    class func fit(_ bounds: GMSCoordinateBounds) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)fitBounds:(nonnull GMSCoordinateBounds *)bounds;
  • This is similar to +fitBounds: but allows specifying the padding (in points) in order to inset the bounding box from the view’s edges.

    If the requested padding is larger than the view size in either the vertical or horizontal direction the map will be maximally zoomed out.

    Declaration

    Swift

    class func fit(_ bounds: GMSCoordinateBounds, withPadding padding: CGFloat) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)fitBounds:(nonnull GMSCoordinateBounds *)bounds
                               withPadding:(CGFloat)padding;
  • This is similar to +fitBounds: but allows specifying edge insets in order to inset the bounding box from the view’s edges.

    If the requested edgeInsets are larger than the view size in either the vertical or horizontal direction the map will be maximally zoomed out.

    Declaration

    Swift

    class func fit(_ bounds: GMSCoordinateBounds, with edgeInsets: UIEdgeInsets) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)fitBounds:(nonnull GMSCoordinateBounds *)bounds
                            withEdgeInsets:(UIEdgeInsets)edgeInsets;
  • Returns a GMSCameraUpdate that shifts the center of the view by the specified number of points in the x and y directions. X grows to the right, Y grows down.

    Declaration

    Swift

    class func scrollBy(x dX: CGFloat, y dY: CGFloat) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)scrollByX:(CGFloat)dX Y:(CGFloat)dY;
  • Returns a GMSCameraUpdate that zooms with a focus point; the focus point stays fixed on screen.

    Declaration

    Swift

    class func zoom(by zoom: Float, at point: CGPoint) -> GMSCameraUpdate

    Objective-C

    + (nonnull GMSCameraUpdate *)zoomBy:(float)zoom atPoint:(CGPoint)point;