An interface element that displays a noninteractive map for the location you specify.
- iOS 8.2+
- watchOS 2.0+
Maps must be configured dynamically from your interface controller. Use the methods of
WKInterface to specify the visible region of the map and to add any annotations or points of interest. Tapping the map launches the Maps app on the user’s Apple Watch and displays the corresponding location.
Using a map object, you specify a geographic region to display and you can optionally add annotations to the surface of the map. Annotations are images that are displayed on top of the map content. You can use custom images or display the built-in pin images. Maps can display no more than five annotations at a time.
Do not subclass or create instances of this class yourself. Instead, define outlets in your interface controller class and connect them to the corresponding objects in your storyboard file. For example, to refer to a map object in your interface, define a property with the following syntax in your interface controller class:
During the initialization of your interface controller, WatchKit creates a new instance of this class and assigns it to your outlet. At that point, you can use the object in your outlet to make changes to the onscreen map.
An active network connection is required to download map tiles.
Additional Information About Maps in watchOS 1
In watchOS 1, WatchKit coalesces the data from all setter method calls made during the same run loop iteration and transmits that data to the user’s Apple Watch at the end of the run loop. If you set an attribute to different values in the same run loop iteration, only the last value is transmitted. If you set an attribute to the same value in the same run loop iteration, WatchKit generates a log message so that you can track down the duplicate change.
Interface Builder Configuration Options
Xcode lets you configure information about your group interface object in your storyboard file. Table 1 lists the attributes you can configure in your storyboard and their meaning.
A checkbox that indicates whether the map is enabled. When the map is enabled, tapping it launches the Maps app and displays the currently set location.