I want to be able to change to change the colours of a CAGradientLayer
in realtime with values i receive over @IBAction
in the main ViewController
. UISlider
moves, color changes in background. I m asking for a theoretical approach.
What is the pattern or technique used to achieve this ? i really got lost and the mighty internet didn't reveal any usable help.
Subclasssing a
UIView
and add thegradientLayer
there ? Then observe the variable with the incoming values and let KVO update the array entries (color sets) withcgColor
values ?Instantiate the
gradientLayer
in the mainViewControlle
r and update its color Properties there when value changes come in via@IBAction
?
Code helps, but its secondary here. i am asking more for a theoretical solution. I try to follow MVC but i am hardly confused where the gradientLayer should be instantiated, whats the best method to change the colours dynamically ect… open for inputs, thx