我正在尝试研究如何更改Skobbler SDK for iOS导航方面的视觉建议(箭头)颜色。我想在颜色方面定制视觉建议的各个方面......
我有以下内容:
let configAdvice = SKVisualAdviceConfiguration.visualAdviceColor()
configAdvice.countryCode = "US"
configAdvice.streetType = SKStreetType.Secondary
configAdvice.routeStreetColor = UIColor.blackColor()
configAdvice.allowedStreetColor = UIColor.blackColor()
configAdvice.forbiddenStreetColor = UIColor.blackColor()
// config.routeStreetColor = [UIColor colorWithHex:color alpha:1.0];
// config.allowedStreetColor = [UIColor colorWithHex:color alpha:0.0f];
// config.forbiddenStreetColor = [UIColor colorWithHex:color alpha:0.0f];
SKRoutingService.sharedInstance().visualAdviceConfigurations = [configAdvice]
let settings: SKAdvisorSettings = SKAdvisorSettings()
let currentLanguage: String = "en_us"
settings.advisorVoice = currentLanguage
settings.advisorType = .AudioFiles
SKRoutingService.sharedInstance().advisorConfigurationSettings = settings
结果是:
正如您所见,箭头是白色的,很难看到。所以我不确定为什么代码没有反映在视觉效果......
答案 0 :(得分:1)
视觉指示:听didChangeFirstVisualAdvice。 在SKRouteState参数内,您将找到有关以下内容的信息:
设置"彩色建议的颜色方案"使用以下visualAdviceConfigurations设置:
SKVisualAdviceConfiguration *visualAdviceColor1 = [SKVisualAdviceConfigurationvisualAdviceColor];
visualAdviceColor1.countryCode = @“DE";
visualAdviceColor1.streetType = SKStreetTypeSecondary;
visualAdviceColor1.routeStreetColor = [UIColor whiteColor];
visualAdviceColor1.allowedStreetColor = [UIColor grayColor];
visualAdviceColor1.forbiddenStreetColor = [UIColor blackColor];
[SKRoutingServicesharedInstance].visualAdviceConfigurations = @[visualAdviceColor1];
以下是演示应用程序(SDKTools项目)中使用的代码:
- (void)updateVisualAdviceSign {
SKTNavigationVisualAdviceView *adviceView = self.mainView.navigationView.visualAdviceView;
if (self.navigationInfo.firstAdvice) {
if (self.navigationInfo.firstAdviceIsLast) {
NSString *imageName = self.colorScheme[[SKTNavigationUtils destinationImageNameForStreetType:self.navigationInfo.nextStreetType]];
imageName = [@"Icons/DestinationImages" stringByAppendingPathComponent:imageName];
adviceView.signImageView.image = [UIImage navigationImageNamed:imageName];
} else {
SKVisualAdviceConfiguration *config = [self configurationForStreetType:self.navigationInfo.nextStreetType];
adviceView.signImageView.image = [[SKRoutingService sharedInstance] visualAdviceImageForRouteAdvice:self.navigationInfo.firstAdvice color:config];
}
} else {
adviceView.signImageView.image = nil;
}
}
和
- (SKVisualAdviceConfiguration *)configurationForStreetType:(SKStreetType)streetType {
NSString *name = [SKTNavigationUtils adviceSignColorNameForStreetType:streetType];
uint32_t color = [self.colorScheme[name] unsignedIntValue];
SKVisualAdviceConfiguration *config = [SKVisualAdviceConfiguration visualAdviceColor];
config.streetType = streetType;
config.countryCode = self.navigationInfo.currentCountryCode;
config.routeStreetColor = [UIColor colorWithHex:color alpha:1.0];
config.allowedStreetColor = [UIColor colorWithHex:color alpha:0.0f];
config.forbiddenStreetColor = [UIColor colorWithHex:color alpha:0.0f];
return config;
}