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.
Circle overlays - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Circle overlays
- [Instructor] Sometimes, we don't need a point for annotation, but instead an area, line, or tile. To show those on a map, we use an overlay. Overlays setup a lot like annotations. We start with an overlay of a object, and then the MapKit delegate method for overlays, tell the system what overlays views go where. Overlays can have several standard shapes. You can use circles, polygons, and poly lines as built in shapes, plus the tile overlay. I'll introduce overlays with circles. Let's suppose we want to show a delivery area using a circle as the delivery area. We need an instance of MK circle class to do that. Based on a center point, and a radius. I'll use the coordinate of the restaurant as our center, and a distance in meters, which becomes the radius of our circle. Close the app. And head over to the instant methods for the overlays where I have a nice little mark. And we're going to add a new function here. Add delivery overlay. And I'm going to make a radius of 1,600 meters…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.