我正在使用SKMaps中的导航,而我的班级正在使用提供以下方法的SKNavigationDelegate:
func routingService(routingService: SKRoutingService!, didChangeCurrentAdvice currentAdvice: SKRouteAdvice!, isLastAdvice: Bool)
documentation表示currentAdvice应该提供当前的建议字符串。我正在使用
currentAdvice.adviceInstruction
但那是一个空字符串......我错过了什么吗?
同样在这个委托方法中,我正在尝试使用建议并将其作为标签放在屏幕上,但是我似乎无法显示标签文本...我设置了一个断点,所以我知道正在调用方法,但它只输出一个空标签。有什么想法吗?
修改:添加设置:
在我的SKRouteSettings中我有
let route = SKRouteSettings()
route.startCoordinate = SKPositionerService.sharedInstance().currentCoordinate
route.destinationCoordinate = destinationCoordinate
route.shouldBeRendered = true // If false, the route will not be rendered.
route.routeMode = SKRouteMode.Pedestrian
route.maximumReturnedRoutes = 1
route.requestAdvices = true
和SKNavigationSettings
let navSettings = SKNavigationSettings()
navSettings.navigationType = SKNavigationType.Simulation
navSettings.distanceFormat = SKDistanceFormat.MilesFeet
SKRoutingService.sharedInstance().mapView.settings.displayMode = SKMapDisplayMode.Mode3D
SKRoutingService.sharedInstance().startNavigationWithSettings(navSettings)