2015-03-19 42 views
2

在演示版本中,我注意到帶有箭頭的標題,指向下一個回合,以及距離和用戶需要轉向的下一條街道的名稱。如何在skobbler導航中啓用標題下一回合視圖

這裏是截圖: enter image description here

我無法從文檔也不演示應用程序如何啓用它搞清楚。 Anny的建議?

+0

導航UI包含一些開箱即用的控件,說明如何將導航事件轉換爲UI通知 - 查看代碼示例的SDKTools項目 – Ando 2015-03-19 13:02:18

+0

我似乎無法弄清楚。你可以指點我到項目中的哪個位置,我可以找到我需要的代碼? – SteBra 2015-03-19 14:08:00

+0

我正在瀏覽NavigationUIViewController,但找不到它 – SteBra 2015-03-19 14:08:29

回答

1

首先,必須實施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]; 

} 
相關問題