GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
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;
-
Declaration
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).
-
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;
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-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSCameraUpdate\u003c/code\u003e objects are used to change the viewpoint and properties of a \u003ccode\u003eGMSMapView\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThey offer methods for zooming, panning, and adjusting the camera target.\u003c/p\u003e\n"],["\u003cp\u003eYou can fit the camera to specific bounds with optional padding or edge insets.\u003c/p\u003e\n"],["\u003cp\u003eCamera updates are created using factory methods, not direct instantiation.\u003c/p\u003e\n"],["\u003cp\u003eThey encapsulate logic for camera modifications, streamlining map interactions.\u003c/p\u003e\n"]]],[],null,["# GoogleNavigation Framework Reference\n\nGMSCameraUpdate\n===============\n\n @interface GMSCameraUpdate : NSObject\n\n`GMSCameraUpdate` represents an update that may be applied to a [GMSMapView](../Classes/GMSMapView.html).\n\nIt encapsulates some logic for modifying the current camera.\n\nIt should only be constructed using the factory helper methods below.\n- `\n ``\n ``\n `\n\n ### [+zoomIn](#/c:objc(cs)GMSCameraUpdate(cm)zoomIn)\n\n `\n ` \n Returns a `GMSCameraUpdate` that zooms in on the map.\n\n The zoom increment is 1.0. \n\n #### Declaration\n\n Swift \n\n class func zoomIn() -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)zoomIn;\n\n- `\n ``\n ``\n `\n\n ### [+zoomOut](#/c:objc(cs)GMSCameraUpdate(cm)zoomOut)\n\n `\n ` \n Returns a `GMSCameraUpdate` that zooms out on the map.\n\n The zoom increment is -1.0. \n\n #### Declaration\n\n Swift \n\n class func zoomOut() -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)zoomOut;\n\n- `\n ``\n ``\n `\n\n ### [+zoomBy:](#/c:objc(cs)GMSCameraUpdate(cm)zoomBy:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that changes the zoom by the specified amount. \n\n #### Declaration\n\n Swift \n\n class func zoom(by delta: Float) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)zoomBy:(float)delta;\n\n- `\n ``\n ``\n `\n\n ### [+zoomTo:](#/c:objc(cs)GMSCameraUpdate(cm)zoomTo:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that sets the zoom to the specified amount. \n\n #### Declaration\n\n Swift \n\n class func zoom(to zoom: Float) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)zoomTo:(float)zoom;\n\n- `\n ``\n ``\n `\n\n ### [+setTarget:](#/c:objc(cs)GMSCameraUpdate(cm)setTarget:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that sets the camera target to the specified coordinate. \n\n #### Declaration\n\n Swift \n\n class func setTarget(_ target: CLLocationCoordinate2D) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)setTarget:(CLLocationCoordinate2D)target;\n\n- `\n ``\n ``\n `\n\n ### [+setTarget:zoom:](#/c:objc(cs)GMSCameraUpdate(cm)setTarget:zoom:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that sets the camera target and zoom to the specified values. \n\n #### Declaration\n\n Swift \n\n class func setTarget(_ target: CLLocationCoordinate2D, zoom: Float) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)setTarget:(CLLocationCoordinate2D)target\n zoom:(float)zoom;\n\n- `\n ``\n ``\n `\n\n ### [+setCamera:](#/c:objc(cs)GMSCameraUpdate(cm)setCamera:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that sets the camera to the specified [GMSCameraPosition](../Classes/GMSCameraPosition.html). \n\n #### Declaration\n\n Swift \n\n class func setCamera(_ camera: ../Classes/GMSCameraPosition.html) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)setCamera:(nonnull ../Classes/GMSCameraPosition.html *)camera;\n\n- `\n ``\n ``\n `\n\n ### [+fitBounds:](#/c:objc(cs)GMSCameraUpdate(cm)fitBounds:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that transforms the camera such that the specified bounds are\n centered on screen at the greatest possible zoom level. The bounds will have a default padding of\n 64 points.\n\n The returned camera update will set the camera's bearing and tilt to their default zero values\n (i.e., facing north and looking directly at the Earth). \n\n #### Declaration\n\n Swift \n\n class func fit(_ bounds: ../Classes/GMSCoordinateBounds.html) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)fitBounds:(nonnull ../Classes/GMSCoordinateBounds.html *)bounds;\n\n- `\n ``\n ``\n `\n\n ### [+fitBounds:withPadding:](#/c:objc(cs)GMSCameraUpdate(cm)fitBounds:withPadding:)\n\n `\n ` \n This is similar to [+fitBounds:](../Classes/GMSCameraUpdate.html#/c:objc(cs)GMSCameraUpdate(cm)fitBounds:) but allows specifying the padding (in points) in order to inset\n the bounding box from the view's edges.\n\n If the requested `padding` is larger than the view size in either the vertical or horizontal\n direction the map will be maximally zoomed out. \n\n #### Declaration\n\n Swift \n\n class func fit(_ bounds: ../Classes/GMSCoordinateBounds.html, withPadding padding: CGFloat) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)fitBounds:(nonnull ../Classes/GMSCoordinateBounds.html *)bounds\n withPadding:(CGFloat)padding;\n\n- `\n ``\n ``\n `\n\n ### [+fitBounds:withEdgeInsets:](#/c:objc(cs)GMSCameraUpdate(cm)fitBounds:withEdgeInsets:)\n\n `\n ` \n This is similar to [+fitBounds:](../Classes/GMSCameraUpdate.html#/c:objc(cs)GMSCameraUpdate(cm)fitBounds:) but allows specifying edge insets in order to inset the bounding\n box from the view's edges.\n\n If the requested `edgeInsets` are larger than the view size in either the vertical or horizontal\n direction the map will be maximally zoomed out. \n\n #### Declaration\n\n Swift \n\n class func fit(_ bounds: ../Classes/GMSCoordinateBounds.html, with edgeInsets: UIEdgeInsets) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)fitBounds:(nonnull ../Classes/GMSCoordinateBounds.html *)bounds\n withEdgeInsets:(UIEdgeInsets)edgeInsets;\n\n- `\n ``\n ``\n `\n\n ### [+scrollByX:Y:](#/c:objc(cs)GMSCameraUpdate(cm)scrollByX:Y:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that shifts the center of the view by the specified number of points\n in the x and y directions. X grows to the right, Y grows down. \n\n #### Declaration\n\n Swift \n\n class func scrollBy(x dX: CGFloat, y dY: CGFloat) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)scrollByX:(CGFloat)dX Y:(CGFloat)dY;\n\n- `\n ``\n ``\n `\n\n ### [+zoomBy:atPoint:](#/c:objc(cs)GMSCameraUpdate(cm)zoomBy:atPoint:)\n\n `\n ` \n Returns a `GMSCameraUpdate` that zooms with a focus point; the focus point stays fixed on screen. \n\n #### Declaration\n\n Swift \n\n class func zoom(by zoom: Float, at point: CGPoint) -\u003e GMSCameraUpdate\n\n Objective-C \n\n + (nonnull GMSCameraUpdate *)zoomBy:(float)zoom atPoint:(CGPoint)point;"]]