Amol Hirkane
Amol Hirkane

Reputation: 75

How to hide circular compass icon on MKMapview in iOS

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.

MapView

Upvotes: 2

Views: 2369

Answers (4)

Akshay Sunderwani
Akshay Sunderwani

Reputation: 12476

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.

Upvotes: 0

Felix
Felix

Reputation: 35384

Starting in iOS 9 you can finally hide the compass in MKMapView.

mapView.showsCompass = NO;

Upvotes: 6

Vinod N
Vinod N

Reputation: 148

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

Upvotes: 0

iPhone developer.
iPhone developer.

Reputation: 2132

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.

Upvotes: 2

Related Questions