How to hide circular compass icon on MKMapview in iOS - 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.

Starting in iOS 9 you can finally hide the compass in MKMapView.
mapView.showsCompass = NO;

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.

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

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.

Related

Here Map SDK IOS (Premium) tap on the marker

Good afternoon, who once worked with heremap sdk premium for ios. How do I make it possible to click on the NMAMapMarker? What they have written in the documentation does not describe it, but maybe I'm wrong.
there are different option available for NMAMapMarker to use.
This represents a marker used to display an icon on a geographical position on a map. The map handles proper placement of icons on the screen as well as panning and rotation.
+mapMarkerWithGeoCoordinates:
+mapMarkerWithGeoCoordinates:icon:
+mapMarkerWithGeoCoordinates:image:
coordinates
icon
draggable
draggingOffsetEnabled
anchorOffset
-initWithGeoCoordinates:
-initWithGeoCoordinates:icon:
-initWithGeoCoordinates:image:
-setAnchorOffsetUsingLayoutPosition:
-setSize:forZoomLevel:
-setSize:forZoomRange:
-resetIconSize
Check for more details : https://developer.here.com/documentation/ios-premium/3.18/api_reference_jazzy/Classes/NMAMapMarker.html#%2Fc:objc(cs)NMAMapMarker(im)initWithGeoCoordinates.
Please revert with your code implementation in case of any further concern.

Map loosing position on orientation change on Xamarin iOS

I have a custom map in xamarin that i have custom renders in both iOS and Android.
The problem is in iOS when i navigate to a position and then rotate my device to landscape it moves my map center to what I think is lat 0, lon 0
Even if i set my map location when the map is first rendered it resets as soon as the orientation changes.
I use the following code to set the camera position
MKMapCamera cam = new MKMapCamera();
CLLocationCoordinate2D MyPosition;
MyPosition = Constants.centreLatLng
cam.Altitude = 1500;
cam.CenterCoordinate = MyPosition;
Constants.nativeMap.SetCamera(cam, false);
I want it so when i change the orientation my map center stays the same as what it was.
As you can see in the Xamarin official documentation for the MapKit,
https://learn.microsoft.com/en-us/dotnet/api/mapkit.mkmapcamera?view=xamarin-ios-sdk-12 you can try to over ride the DidChange or DidChangeValue function and figure out what the latest value of the camera position is. So then you know what value to set OnSizeAllocated.
Also you might want to try initializing the values of the map shown in the example, because you shouldn't be having this problem.

IOS 11 MKMapview changing zoom level when altering its frame or rotating

I've a MKMapView that I expand and contract with code like this:
UIView.animate(withDuration: 0.5) {
mapView.frame = CGRect(x: 0, y: 0, width: 200, height: 400)
}
Before IOS 11 the above code would trigger regionDidChangeAnimateddelegate method after animation was completed. It would change its region and let zoom level be.
In IOS 11 just the zoom changes. None of the delegate methods are triggered.
I need to have it like before. Changing maps frame should just make the visible area bigger without zoom change.
I've tried to set mapView.isZoomEnabled = false before altering mapViews frame, but the zoom level keeps changing.
Update:
I added two animated GIFs to compare IOS 11 with previous IOS versions.
IOS 11 will zoom in immediately before expand animation starts. It will zoom out after the reverse animation is completed.
As you see below the IOS 9 animation is smooth as silk.
IOS 11:
IOS 9:
Found a solution! More of a hack:
Center the MapView on Y and give the MapView a fixed height, I used: UIScreen.main.bounds.size.height.
After attempting to create my own map view, and duplicating your GIFs, it appears that this is an issue in iOS 11. I've seen similar effects happens with other views in the past.
While it won't match what your iOS 9 GIF above shows, an alternative to changing the frame might be to change the transform property. The map will of course, shrink, but there will not be any visible artifacts as seen above.

How to set MKMapView view angle and turn off 3D building?

I am currently working on a navigation app. Is there a way to set view angle in MapKit? I know Google Map iOS SDK has it as one of parameter in viewing camera that you could set, but I wasn't able to find it in MapKit.
Also is there a bool value to turn off 3D building? They are kind of annoying for a navigation app.
Thanks in advance!
Add in viewDidLoad or viewWillAppear:
self.mapView.pitchEnabled = YES;
self.mapView.pitchEnabled = NO;
self.mapView.showsBuildings = false
(swift code) Turns off buildings.
Swift 4
mapView.settings.tiltGestures = false
Use pitch to provide viewing angle. For example, mapview.pitch or mapview.camera.pitch depending on whether you are using a camera or not. Also, set showsbuildng to NO.

about the api of UIImagePickerController in iOS 5

I overlay the UIImagePickerController with my design, and i set the showsCameraControls = NO, the zoom bar will not show both in iOS 4 and iOS 5, but the function of zoom will work in iOS 5, I can use two of my fingers to zoom in/out, but I don't want this function, so how can i stop the zoom function? I can not find this API in iOS 5 developer file, so please help me.thanks
I am not sure what you mean by 'zoom'.
Are you looking for -[UIImagePickerController allowsEditing]? Set it to NO, and the image simply is shown. Set to YES, and you can 'zoom' into the image, and import only that area of the image.

Resources