MKMapCamera object describes a virtual camera that you use to define the appearance of the map. A camera object creates a virtual viewpoint above the map surface and affects how the map renders its tiles and other content. You use a camera object to specify the location of the camera on the map, the compass heading that corresponds to the camera’s viewing direction, the pitch of the camera relative to the map perpendicular, and the camera’s altitude above the map. These factors let you create a map view that is not just flat but offers a more 3D-like experience.
After creating an instance of this class, configure it with the desired attributes and assign it to your map view. When you assign a camera to your map view, the map centers the map using the value in your camera object’s
centerCoordinate property, updating the map’s own region information in the process. The map also takes the camera’s the pitch and altitude into account when calculating the visible region, ensuring that the region always encompasses the visible content on the map.
Returns a new camera object for you to configure.
A new camera object.
You must change the values of the returned camera object before using it.
Returns a new camera object using the specified viewing angle information.
The coordinate point on which the map should be centered.
The coordinate point at which to place the camera. If the value for this parameter is equal to the value in the
centerCoordinateparameter, the map is displayed as if the camera is looking straight down. If this point is offset from the
centerCoordinatevalue, the map is displayed with an appropriate heading and pitch angle.
The altitude (in meters) above the ground at which to place the camera.
A new camera object initialized with the specified information.
This method calculates the required pitch and heading angles to accommodate the specified eye position and altitude.
The map coordinate at the center of the map view.
@property (nonatomic) CLLocationCoordinate2D centerCoordinate;
This point represents the coordinate on which the map should be centered. When the camera pitch is 0, this property also corresponds to the geographic position of the camera. Changing the pitch to a nonzero value moves the camera but does not affect this property.
The heading of the camera (measured in degrees) relative to true north.
@property (nonatomic) CLLocationDirection heading;
0means that the top edge of the map view corresponds to true north. The value
90means the top of the map is pointing due east. The value
180means the top of the map points due south, and so on.
The viewing angle of the camera, measured in degrees.
@property (nonatomic) CGFloat pitch;
A value of
0results in a camera pointed straight down at the map. Angles greater than
0result in a camera that is pitched toward the horizon by the specified number of degrees. If the map type is
MKMapTypeHybrid, the pitch value is clamped to
The value in this property may be clamped to a maximum value to maintain map readability. There is no fixed maximum value, though, because the actual maximum value is dependent on the current altitude of the camera.
The altitude above the ground, measured in meters.
@property (nonatomic) CLLocationDistance altitude;
The value you specify for this property must not be less than
Changing this property may also change the maximum pitch that is allowed for the map. If the current pitch value exceeds the new maximum, the
pitchproperty is clamped to the new maximum.