gpt4 book ai didi

ios - UISlider setMaximumTrackTintColor

转载 作者:技术小花猫 更新时间:2023-10-29 10:20:12 25 4
gpt4 key购买 nike

我正在尝试动态配置 UISlider 上的轨道颜色。

这行代码非常适合设置 slider 轨道的低端。

[self.sliderBar setMinimumTrackTintColor:[UIColor redColor]];

当尝试对 slider 轨道的高端执行相同操作时,这行代码向调试日志报告了 3 个 fatal error 。

[self.sliderBar setMaximumTrackTintColor:[UIColor redColor]];

<Error>: CGContextAddPath: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context  and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

<Error>: clip: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

<Error>: CGContextDrawLinearGradient: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

我也曾尝试使用点符号设置轨道色调颜色,但报告了相同的 3 个错误。

self.sliderBar.maximumTrackTintColor = [UIColor redColor];

我很困惑为什么最小轨道色调颜色设置正确,而最大轨道色调颜色却被破坏了。任何帮助将不胜感激。

这个问题似乎与this有关问题,但我不是 100% 确定,因为我没有使用图形(仅设置色调颜色)。

最佳答案

这很奇怪,最小值和最大值对我来说都很好,我什至可以让它动画化颜色变化。我只能建议重新创建 slider 和@synthesize。

@synthesize slider;

- (void)viewDidLoad
{
[super viewDidLoad];
[slider setMinimumTrackTintColor:[UIColor orangeColor]];
[slider setMaximumTrackTintColor:[UIColor blueColor]];



// Do any additional setup after loading the view, typically from a nib.
}

Slider with 2 different colors

关于ios - UISlider setMaximumTrackTintColor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21683348/

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