Create a few properties:
/** The value for the red channel of the colour of the label. */
@property (nonatomic, strong) CGFloat rValue;
/** The value for the green channel of the colour of the label. */
@property (nonatomic, strong) CGFloat gValue;
/** The value for the blue channel of the colour of the label. */
@property (nonatomic, strong) CGFloat bValue;
/** The value for the alpha channel of the colour of the label. */
@property (nonatomic, strong) CGFloat aValue;
Update them with their respective UISlider
values.
In each UISlider
callback call - (void)setNeedsDisplay
to trigger the drawRect
.
In the drawRect
do this:
UIColor fillColour = [[UIColor alloc] initWithRed:self.rValue green:self.gValue blue:self.bValue alpha:self.aValue];
[fillColour setFill];
This will set the fill colour to the colour determined by the sliders. Then when you fill your rect, it will be that colour.