gpt4 book ai didi

ios - 如何在 Skobbler SDK for iOS 中更改视觉顾问颜色

转载 作者:行者123 更新时间:2023-11-29 12:08:11 25 4
gpt4 key购买 nike

我正在尝试找出如何更改 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

结果是: image

如您所见,箭头是白色的,很难看到。所以我不确定为什么代码没有反射(reflect)在视觉效果中......

最佳答案

视觉说明:听didChangeFirstVisualAdvice .在 SKRouteState 参数中,您将找到有关以下方面的信息:

  • 当前(第一个)视觉建议的路径:currentVisualAdvicePath(如果您想要彩色图像,请使用 firstVisualAdviceImageWithColor)
  • 下一个(第二个)视觉建议的路径:secondaryVisualAdvicePath(如果您想要彩色图像,请使用 secondVisualAdviceImageWithColor)

要为“彩色建议”设置配色方案,请使用以下 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com