josefdlange
josefdlange

Reputation: 453

Navigate a route without following it in the SKMapView

SKMaps is an excellent framework for a lot of mapping uses. I have a bit of a unique requirement and I'm hoping someone might have a solution. I'm curious if I can calculate a route, paint that route on the map, and then start navigation without having the map adopt the follow-the-driver UI. I want to be able to continue some basic interaction with the map (including animating different points to the center, etc) while navigation is in-progress.

My ViewController is both the routing delegate and the navigation delegate of the SKRoutingService shared instance. I did attempt to set the routing service's mapView pointer to nil when the route gets calculated, right before I start navigation, but to no success -- the mapView still zooms into the current location, the current position icon changes to the navigation one, and the map starts following the driver.

Any ideas?

Upvotes: 1

Views: 144

Answers (1)

Ando
Ando

Reputation: 11409

Set the following after starting navigation:

[[SKRoutingService sharedInstance]startNavigationWithSettings:navSettings];    
self.mapView.settings.followUserPosition = NO;
self.mapView.settings.headingMode = SKHeadingModeNone;
self.mapView.settings.displayMode = SKMapDisplayMode2D;
SKCoordinateRegion region;
region.center = CLLocationCoordinate2DMake(37.9667, 23.7167);
region.zoomLevel = 17;
self.mapView.visibleRegion = region;

This would start the navigation but not change the view (the user position will still change on the map, reflecting the change in position)

Upvotes: 1

Related Questions