I want to hide the circular compass icon on MKMapview
which appears when a user rotates the map. I have attached a screen shot for reference. I don't want to display the circular compass icon but I do want to allow rotation on the map.

- 18,301
- 9
- 84
- 152

- 75
- 1
- 11
-
if i set myMapViewObject.rotateEnabled = NO; then this icon not appear, but i dont want to disable rotation. – Amol Hirkane May 06 '15 at 10:41
-
1Here is your answer http://stackoverflow.com/a/19196725/790842. And for your layout I have a suggestion, to move the SearchBar to the Navigationbar, so it won't be blocked by compass. – iphonic May 06 '15 at 10:44
-
Are you adding the "Search for Oulet" ("Ou**t**let"?) view to the MKMapView directly? That would explain why the compass appears on top. Like iphonic says, the search view should be added as a subview of the parent vc view, not the map view. Don't modify the map's internal view hierarchy. – May 06 '15 at 12:05
4 Answers
Starting in iOS 9 you can finally hide the compass in MKMapView
.
mapView.showsCompass = NO;

- 35,354
- 13
- 96
- 143
If you're not rotating the map programatically and it hasn't already been rotated, disable rotation entirely, using
mapView.rotateEnabled = NO; The compass only shows up when the map is rotated, so by doing this you ensure that the compass is never triggered.

- 2,122
- 1
- 16
- 17
-
Thanks,but i already mentioned i don't want to restrict from rotation. – Amol Hirkane May 06 '15 at 10:53
The current iOS maps does not have the option to turn off the compass. MapKit Class in the apple documentation also does not carry any information about a compass setting as either a property or creation only setting.
Without restriction on rotation you need to try with the solution given at following url:
http://jdkuzma.tumblr.com/post/79294999487/xcode-mapview-offsetting-the-compass-and-legal

- 148
- 4
-
Please consider putting in essential parts of the answers here. Link only answers can go dead over a period of time. – Nilesh May 06 '15 at 11:06
You can either try it by setting its layout margin:
By moving a little bit lower:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(20, 0, 20, 0)];
or moving it up a little bit higher:
[self.mapView setLayoutMargins:UIEdgeInsetsMake(-50, 0, -50, 0)];
Hope this might get you what you need.

- 12,428
- 8
- 29
- 52