在演示版中,我注意到带有箭头的标题,指向下一个转弯,以及距离和用户需要转弯的下一条街道的名称。
这是屏幕截图:
我无法从文档或演示应用程序中弄清楚如何启用它。
有什么建议吗?
最佳答案
首先,必须实现 SKNavigationDelegate 和 SKRoutingDelegate。
不要忘记设置代表:
[SKRoutingService sharedInstance].routingDelegate = self;
[SKRoutingService sharedInstance].navigationDelegate = self;
非常重要的一段代码:
SKAdvisorSettings* advisorSettings = [[SKAdvisorSettings alloc]init];
[SKRoutingService sharedInstance].advisorConfigurationSettings = advisorSettings;
[Constants shared].route.requestAdvices=YES;
然后,在计算出路线后,您将能够使用这些方法:
-(void)routingService:(SKRoutingService *)routingService didChangeNextStreetName:(NSString *)nextStreetName streetType:(SKStreetType)streetType countryCode:(NSString *)countryCode
{
// This method returns the Name of the next street
_txtNextStreetName.text = [NSString stringWithFormat:@"%@",nextStreetName];
}
// This method returns visual guidance to the next turn on the road
-(void)routingService:(SKRoutingService *)routingService didChangeCurrentAdviceImage:(UIImage *)adviceImage withLastAdvice:(BOOL)isLastAdvice
{
[_imgVisualAdvice setImage:adviceImage];
}
//还有距离
-(void)routingService:(SKRoutingService *)routingService didChangeSecondaryVisualAdviceDistance:(int)distance withFormattedDistance:(NSString *)formattedDistance
{
_txtNextStreetDistance.text = [NSString StringWithFormat:@"%@",formattedDistance];
}
关于ios - 如何在 skobbler 导航中启用标题下一回合 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29144535/