I want to create an UIView Class that you can initialise with several options.
I think the problem is the drawRect() method. Is it possible to initialise the class with a certain option like
[[MyUIView alloc]initWithColor:[UIColor blueColor]]
I read that I should never call the drawRect() method without initialising an object.
So how can I realize the statement above without calling it manually?
What I have tried so far:
I thought that I could just initialize the View and then call Method
[MyView changeColorTo:green]
which tries to redraw the View however I couldn’t get that to work.
Maybe it’s important that I draw with coreGraphics (with a certain color, which should be selectable) a rounded rectangle in the drawRect() method.
How can I implement my desired behaviour?
call
that calls drawRect: for you.
Edit on the color property: