作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试找出如何更改 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
结果是:
如您所见,箭头是白色的,很难看到。所以我不确定为什么代码没有反射(reflect)在视觉效果中......
最佳答案
视觉说明:听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;
}
关于ios - 如何在 Skobbler SDK for iOS 中更改视觉顾问颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34346782/
我是一名优秀的程序员,十分优秀!