December 2017
Intermediate to advanced
648 pages
13h 46m
English
In this chapter, we will have a look at some awesome updates to the MapKit and Core Location frameworks.
Instead of letting your map view display the compass or user tracking buttons (as it does by default), you want to place these buttons somewhere else in your application’s UI.
Follow these steps:
MKUserTrackingButton that inherits from UIView. You can then add this view to another view in your view hierarchy. Alternatively you can create an instance of UIBarButtonItem using its UIBarButtonItem(customView:) method, which lets you place the bar button on a navigation item. In the Discussion, we’ll show an example that uses a UIBarButtonItem.MKCompassButton class that also inherits from the UIView class. To display it, you have the same options as for the user tracking button.mapType property of your map view to mutedStandard, of type MKMapType, so that the map view itself does not show the standard buttons and views.showsCompass property of your map view to false, so that the map view does not show its own compass button.The resulting map view and navigation bar are shown in Figure 15-1.
Read now
Unlock full access