From the course: Advanced iOS App Development: MapKit & Core Location

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use cameras

Use cameras - iOS Tutorial

From the course: Advanced iOS App Development: MapKit & Core Location

Start my 1-month free trial

Use cameras

- [Male Instructor] You used a region of your map using coordinates and distance. You might want to use altitude, or change the heading as well. To do that, you need a different property for viewing coordinates, the camera. The camera works by setting a center coordinate and then setting the distance in the camera from that point as an altitude. Close the app. Cameras are of type MKMapCamera. Go to view controller, and up to the properties and add a new property for a camera, var camera equals MKMapCamera. Go back down to your location picker, and go to case two, which is Chicago. Under the current code, add this camera.centerCoordinate equals coordinate2D. That sets our center coordinate. We'll set the altitude to 50 meters, and that will be camera altitude equals 50.0. And then I'll set the camera property on map view by going mapView.camera equals camera. So, I don't do the update that's on the bottom for the region, I'm going to go ahead and return right after here. With that…

Contents