GMSPanoramaView
@interface GMSPanoramaView : UIView
A panorama is used to display Street View imagery. It should be constructed via
[[GMSPanoramaView alloc] initWithFrame:]
, and configured post-initialization.
All properties and methods should be accessed on the main thread, similar to all UIKit
objects.
The GMSPanoramaViewDelegate
methods will also be called back only on the main thread.
The backgroundColor of this view is shown while no panorama is visible, such as while it is loading or if the panorama is later set to nil. The alpha color of backgroundColor is not supported.
-
The panorama to display; setting it will transition to a new panorama. This is animated, except for the initial panorama.
Can be set to nil to clear the view.
Declaration
Swift
var panorama: GMSPanorama? { get set }
Objective-C
@property (nonatomic, nullable) GMSPanorama *panorama;
-
GMSPanoramaView
delegate.Declaration
Swift
@IBOutlet weak var delegate: (any GMSPanoramaViewDelegate)? { get set }
Objective-C
@property (nonatomic, weak, nullable) id<GMSPanoramaViewDelegate> delegate;
-
Sets the preference for whether all gestures should be enabled (default) or disabled.
This does not limit programmatic movement of the camera or control of the panorama.
Declaration
Swift
func setAllGesturesEnabled(_ enabled: Bool)
Objective-C
- (void)setAllGesturesEnabled:(BOOL)enabled;
-
Controls whether orientation gestures are enabled (default) or disabled. If enabled, users may use gestures to change the orientation of the camera.
This does not limit programmatic movement of the camera.
Declaration
Swift
var orientationGestures: Bool { get set }
Objective-C
@property (nonatomic) BOOL orientationGestures;
-
Controls whether zoom gestures are enabled (default) or disabled. If enabled, users may pinch to zoom the camera.
This does not limit programmatic movement of the camera.
Declaration
Swift
var zoomGestures: Bool { get set }
Objective-C
@property (nonatomic) BOOL zoomGestures;
-
Controls whether navigation gestures are enabled (default) or disabled. If enabled, users may use a single tap on navigation links or double tap the view to change panoramas.
This does not limit programmatic control of the panorama.
Declaration
Swift
var navigationGestures: Bool { get set }
Objective-C
@property (nonatomic) BOOL navigationGestures;
-
Controls whether the tappable navigation links are hidden or visible (default). Hidden navigation links cannot be tapped.
Declaration
Swift
var navigationLinksHidden: Bool { get set }
Objective-C
@property (nonatomic) BOOL navigationLinksHidden;
-
Controls whether the street name overlays are hidden or visible (default).
Declaration
Swift
var streetNamesHidden: Bool { get set }
Objective-C
@property (nonatomic) BOOL streetNamesHidden;
-
Controls the panorama’s camera. Setting a new camera here jumps to the new camera value, with no animation.
Declaration
Swift
var camera: GMSPanoramaCamera { get set }
Objective-C
@property (nonatomic) GMSPanoramaCamera *_Nonnull camera;
-
Accessor for the custom
CALayer
type used for the layer.Declaration
Swift
var layer: GMSPanoramaLayer { get }
Objective-C
@property (nonatomic, retain, readonly) GMSPanoramaLayer *_Nonnull layer;
-
Animates the camera of this
GMSPanoramaView
tocamera
, overduration
- (specified in seconds).
Declaration
Swift
func animate(to camera: GMSPanoramaCamera, animationDuration duration: TimeInterval)
Objective-C
- (void)animateToCamera:(nonnull GMSPanoramaCamera *)camera animationDuration:(NSTimeInterval)duration;
-
Modifies the camera according to
cameraUpdate
, overduration
(specified in seconds).Declaration
Swift
func updateCamera(_ cameraUpdate: GMSPanoramaCameraUpdate, animationDuration duration: TimeInterval)
Objective-C
- (void)updateCamera:(nonnull GMSPanoramaCameraUpdate *)cameraUpdate animationDuration:(NSTimeInterval)duration;
-
Requests a panorama near
coordinate
.Upon successful completion
-panoramaView:didMoveToPanorama:
and-panoramaView:didMoveToPanorama:nearCoordinate:
will be sent toGMSPanoramaViewDelegate
.On error
-panoramaView:error:onMoveNearCoordinate:
will be sent.Repeated calls to
-moveNearCoordinate:
result in the previous pending (incomplete) transitions being cancelled – only the most recent of-moveNearCoordinate:
and-moveToPanoramaId:
will proceed and generate events.Declaration
Swift
func moveNearCoordinate(_ coordinate: CLLocationCoordinate2D)
Objective-C
- (void)moveNearCoordinate:(CLLocationCoordinate2D)coordinate;
-
Similar to
-moveNearCoordinate:
but allows specifying a search radius (meters) aroundcoordinate
.Declaration
Swift
func moveNearCoordinate(_ coordinate: CLLocationCoordinate2D, radius: UInt)
Objective-C
- (void)moveNearCoordinate:(CLLocationCoordinate2D)coordinate radius:(NSUInteger)radius;
-
Similar to
-moveNearCoordinate:
but allows specifying a source nearcoordinate
.This API is experimental and may not always filter by source.
Declaration
Swift
func moveNearCoordinate(_ coordinate: CLLocationCoordinate2D, source: GMSPanoramaSource)
Objective-C
- (void)moveNearCoordinate:(CLLocationCoordinate2D)coordinate source:(GMSPanoramaSource)source;
-
Similar to
-moveNearCoordinate:
but allows specifying a search radius (meters) aroundcoordinate
and a source.This API is experimental and may not always filter by source.
Declaration
Swift
func moveNearCoordinate(_ coordinate: CLLocationCoordinate2D, radius: UInt, source: GMSPanoramaSource)
Objective-C
- (void)moveNearCoordinate:(CLLocationCoordinate2D)coordinate radius:(NSUInteger)radius source:(GMSPanoramaSource)source;
-
Requests a panorama with
panoramaID
.Upon successful completion
-panoramaView:didMoveToPanorama:
will be sent toGMSPanoramaViewDelegate
.On error
-panoramaView:error:onMoveToPanoramaID:
will be sent.Repeated calls to
-moveToPanoramaID:
result in the previous pending (incomplete) transitions being cancelled – only the most recent of-moveNearCoordinate:- and
-moveToPanoramaId:` will proceed and generate events.Only panoramaIDs obtained from the Google Maps SDK for iOS are supported.
Declaration
Swift
func move(toPanoramaID panoramaID: String)
Objective-C
- (void)moveToPanoramaID:(nonnull NSString *)panoramaID;
-
For the current view, returns the screen point the
orientation
points through. This value may be outside the view for forward facing orientations which are far enough away from straight ahead.The result will contain NaNs for camera orientations which point away from the view, where the implied screen point would have had a negative distance from the camera in the direction of orientation.
Declaration
Swift
func point(for orientation: GMSOrientation) -> CGPoint
Objective-C
- (CGPoint)pointForOrientation:(GMSOrientation)orientation;
-
Given a point for this view, returns the current camera orientation pointing through that screen location. At the center of this view, the returned
GMSOrientation
will be approximately equal to that of the currentGMSPanoramaCamera
.Declaration
Swift
func orientation(for point: CGPoint) -> GMSOrientation
Objective-C
- (GMSOrientation)orientationForPoint:(CGPoint)point;
-
Convenience constructor for
GMSPanoramaView
, which searches for and displays aGMSPanorama
nearcoordinate
. This performs a similar action to that of-moveNearCoordinate:
, and will call the same delegate methods.Declaration
Swift
class func panorama(withFrame frame: CGRect, nearCoordinate coordinate: CLLocationCoordinate2D) -> Self
Objective-C
+ (nonnull instancetype)panoramaWithFrame:(CGRect)frame nearCoordinate:(CLLocationCoordinate2D)coordinate;
-
Similar to panoramaWithFrame:nearCoordinate: but allows specifying a search radius (meters) around
coordinate
.Declaration
Swift
class func panorama(withFrame frame: CGRect, nearCoordinate coordinate: CLLocationCoordinate2D, radius: UInt) -> Self
Objective-C
+ (nonnull instancetype)panoramaWithFrame:(CGRect)frame nearCoordinate:(CLLocationCoordinate2D)coordinate radius:(NSUInteger)radius;
-
Convenience constructor for
GMSPanoramaView
, which searches for and displays aGMSPanorama
nearcoordinate
. This performs a similar action to that of-moveNearCoordinate:source
, and will call the same delegate methods.This API is experimental and may not always filter by source.
Declaration
Swift
class func panorama(withFrame frame: CGRect, nearCoordinate coordinate: CLLocationCoordinate2D, source: GMSPanoramaSource) -> Self
Objective-C
+ (nonnull instancetype)panoramaWithFrame:(CGRect)frame nearCoordinate:(CLLocationCoordinate2D)coordinate source:(GMSPanoramaSource)source;
-
Convenience constructor for
GMSPanoramaView
, which searches for and displays aGMSPanorama
nearcoordinate
. This performs a similar action to that of-moveNearCoordinate:radius:source
, and will call the same delegate methods.This API is experimental and may not always filter by source.
Declaration
Swift
class func panorama(withFrame frame: CGRect, nearCoordinate coordinate: CLLocationCoordinate2D, radius: UInt, source: GMSPanoramaSource) -> Self
Objective-C
+ (nonnull instancetype)panoramaWithFrame:(CGRect)frame nearCoordinate:(CLLocationCoordinate2D)coordinate radius:(NSUInteger)radius source:(GMSPanoramaSource)source;