Understanding and creating annotations

In Chapter 11, Finishing Up Your App Structure in Storyboard, you added a map view to the Map screen. A map view is an instance of the MKMapView class and is similar to the one in the Apple Maps app.

When you build and run your app, you will see a map on the screen. The part of the map that is visible onscreen can be specified by setting the region property of the map.


To learn more about regions and how to make them, see https://developer.apple.com/documentation/mapkit/mkmapview/1452709-region.

Pins on the Map screen are used to mark specific locations. To add a pin to a map view, you need an object that conforms to the MKAnnotation protocol.


To learn more about MKAnnotation, see https://developer.apple.com/documentation/mapkit/mkannotation.

When an object conforming to the MKAnnotation protocol is added to a map view, an associated object named MKAnnotationView becomes a subview of the map view and is displayed on the screen. An MKAnnotationView can be customized to display custom icons, which can display callout bubbles when tapped. Callout bubbles can have buttons that perform actions, such as displaying a screen.


To learn more about MKAnnotationView, see https://developer.apple.com/documentation/mapkit/mkannotationview.

Let's learn more about what MKAnnotation is and how it works in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.153.38