Reputation: 31
I am creating a custom view with UIBezierPath
drawing. I want to update the custom view fill color whenever state changes based on response from server. I am using fillColor
property as a param to update view's color. How can i change the fillcolor
programmatically?
Upvotes: 1
Views: 586
Reputation: 535999
You must never call drawRect
. Instead, call setNeedsDisplay
, and drawRect
will be called for you. As for changing the color, it's just a matter of planning ahead — put the color where your drawRect
routine can find it. Thus, for example, if you have a property holding the fill color, you can change that and call setNeedsDisplay
, and the view can thus be redrawn using the new fill color property value.
Upvotes: 5