AI-generated Key Takeaways
-
GMSMapViewOptions
configures the initial appearance and behavior of aGMSMapView
. -
You can customize the initial frame, camera position, background color, and map ID.
-
For CarPlay integration, the
screen
property should be set accordingly. -
If no initial camera is provided, the map defaults to a global view.
-
Background color can be changed, unlike with a standard view's
backgroundColor
.
GMSMapViewOptions
@interface GMSMapViewOptions : NSObject
This class defines initialization-time options for GMSMapView
.
-
Initial frame for the view. Defaults to
CGRectZero
.Declaration
Swift
var frame: CGRect { get set }
Objective-C
@property (nonatomic) CGRect frame;
-
Initial camera position. Defaults to nil.
Declaration
Swift
var camera: GMSCameraPosition? { get set }
Objective-C
@property (nonatomic, nullable) GMSCameraPosition *camera;
-
Specifies the background color of the map view, which displays whenever the map tiles are not fully loaded. This is required because
GMSMapView
ignores the inherited mutable backgroundColor. The color is displayed on the background of the map. Defaults to a light grey color.Declaration
Swift
var backgroundColor: UIColor? { get set }
Objective-C
@property (nonatomic, nullable) UIColor *backgroundColor;
-
The screen the view will be used on.
Defaults to the main screen. Should be set to the CarPlay screen if this map view is to be used with CarPlay.
Declaration
Swift
var screen: UIScreen! { get set }
Objective-C
@property (nonatomic, null_resettable) UIScreen *screen;