I'm trying to dynamically configure the track color on a UISlider.
This line of code works perfectly for setting the low side of the slider track.
[self.sliderBar setMinimumTrackTintColor:[UIColor redColor]];
When trying to do the same thing for the high side of the slider track, this line of code reports 3 fatal errors to the debug log.
[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.
I have also tried to set the track tint colors using dot notation, but the same 3 errors were reported.
self.sliderBar.maximumTrackTintColor = [UIColor redColor];
I am very confused why the minimum track tint color is properly set, while the maximum track tint color is breaking. Any assistance would be greatly appreciated.
This issue seems to be related to this question, but I'm not 100% sure since I'm not working with graphics (only setting the tint color).
That is strange, both min and max work fine for me and I can even have it animate color change. All I can suggest is re-create the slider and also @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.
}