<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKCompassButton",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKCompassButton"
  },
  "title" : "MKCompassButton"
}
-->

# MKCompassButton

A specialized view that displays the compass heading for its associated map.

```
class MKCompassButton
```

## Overview

Use this class when you want to incorporate a standard compass button into your own view hierarchy. A compass button reflects the current orientation of its associated map view. Tapping the compass button reorients the map so that due north is at the top of the map view.

## Topics

### Creating a compass button

[`init(mapView:)`](/documentation/MapKit/MKCompassButton/init(mapView:))

Creates a compass button and associates it with the specified map view.

### Getting the compass attributes

[`mapView`](/documentation/MapKit/MKCompassButton/mapView)

The map view that provides the heading information for the compass button.

[`compassVisibility`](/documentation/MapKit/MKCompassButton/compassVisibility)

The visibility of the compass button.

[`MKFeatureVisibility`](/documentation/MapKit/MKFeatureVisibility)

Constants that indicate the visibility of different map features.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)