微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ios – UISlider setMaximumTrackTintColor

我试图在UiSlider上动态配置轨迹颜色.

代码行适用于设置滑块轨道的低端.

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

当尝试对滑块轨道的高端做同样的事情时,这一行代码向调试日志报告3个致命错误.

[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,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,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%肯定,因为我不使用图形(只设置色调的颜色).

解决方法

这是奇怪的,最小和最大的工作对我来说很好,我甚至可以有它的动画颜色变化.我可以建议的是重新创建滑块和@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.
}

原文地址:https://www.jb51.cc/iOS/336419.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐