如何在skobbler导航中启用标题下一轮视图

时间:2015-03-19 12:25:48

标签: ios objective-c xcode skmaps

在演示版中,我注意到带有箭头的标题,指向下一个转弯,以及距离和用户需要转弯的下一条街道的名称。

这是截图: enter image description here

我无法从文档或演示应用程序中弄清楚如何启用它。 Anny的建议?

1 个答案:

答案 0 :(得分:0)

首先,必须实施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];

}