Moving the center point
Use the anchorTo function of the KNMapCameraUpdate (KO) class to move the center point of the screen. Adjust the value from the exact center (0.5, 0.5) to move the center point. Screen values are expressed as (x-axis, y-axis), where the bottom-left corner is (0, 0) and the top-right corner is (1, 1). To move to the right, add 0.1 to the x-axis; to move upward, add 0.1 to the y-axis.
- (void)moveAnchor{
if(self->centerAnchor) {
[self->mapView animateCamera:[KNMapCameraUpdate anchorTo:FloatPointMake(0.5, 0.8)] duration:animationTime withUserLocation:false];
}
else{
[self->mapView animateCamera:[KNMapCameraUpdate anchorTo:FloatPointMake(0.5, 0.5)] duration:animationTime withUserLocation:false];
}
self->centerAnchor = !self->centerAnchor;
}Zooming in
Use the zoomTo function of the KNMapCameraUpdate (KO) class to zoom in on the screen.
// Zoom in the screen by a factor of two
- (void)zoomIn{
float zoom = self->mapView.zoom;
[self->mapView animateCamera:[KNMapCameraUpdate zoomTo:zoom * 0.5] duration:animationTime withUserLocation:false];
}Zooming out
Use the zoomTo function of the KNMapCameraUpdate (KO) class to zoom out of the screen.
// Zoom out the screen by a factor of two
- (void)zoomOut{
float zoom = self->mapView.zoom;
[self->mapView animateCamera:[KNMapCameraUpdate zoomTo:zoom * 2.0] duration:animationTime withUserLocation:false];
}Switching to bird's eye view
Use the tiltTo function of the KNMapCameraUpdate (KO) class to set a bird's eye view screen that gives a sense of perspective and depth.
- (void)birdView{
[self->mapView animateCamera:[KNMapCameraUpdate tiltTo:50.0] duration:animationTime withUserLocation:false];
}Switching to top view
Use the tiltTo function of the KNMapCameraUpdate (KO) class to set a top view screen that looks down on the map as a flat plane.
- (void)topView{
[self->mapView animateCamera:[KNMapCameraUpdate tiltTo:0.0] duration:animationTime withUserLocation:false];
}Rotating the map
Use the bearingTo function of the KNMapCameraUpdate (KO) class to rotate the map by the angle you set. The rotation can be set within a range of 0 to 360, and the map rotates around its current position.
// Rotate the screen by 45 degrees
- (void)rotate{
float bearing = self->mapView.bearing;
[self->mapView animateCamera:[KNMapCameraUpdate bearingTo:bearing + 45.0] duration:animationTime withUserLocation:false];
}