iphone - compass vanishes when MKMap is oriented to north in iOS -


i displaying map on iphone using mkmapview. map can rotate oriented respect iphone orentation using magnetic heading information.

i present compass vanishes each time map oriented north! reappears when phone rotated little bit further distracting.

the rotation functionality switched on when conditions met so:

@iboutlet weak var mapview: mkmapview! // here comes other code if settings.usemagneticheading && validuserlocation {    mapview.isrotateenabled = true    mapview.showscompass = true    locationservice.startupdatingheading() } 

the rotation performed delegate:

func tracingheading(currentheading: cllocationdirection) {     if settings.usemagneticheading && validuserlocation     {         mapview.camera.heading = currentheading         mapview.setcamera(mapview.camera, animated: true)     } } 

the corelocation stuff encapsulated in locationservice singleton.

how can 1 force show compass when map oriented north? guess behavior feature not bug seems undocumented. (found in ios 9 , ios 10)

you're right. behavior feature not bug.

in ios 11 can use compassvisibility.

let compass = mkcompassbutton(mapview: mapview) compass.compassvisibility = .visible 

https://developer.apple.com/documentation/mapkit/mkcompassbutton/2890262-compassvisibility

enter image description here


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -