Animate colour of circle drawn using CGContextFillEllipseInRect
问题 I have a UIView that draws a circle inside it using the following code: -(void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, myColor); CGContextFillEllipseInRest(context, myRect); } I want to animate this circle to a grey color... How can I achieve this? -(void)fadeToGrey { // What goes here? } 回答1: You should use CAShapeLayer as a layer class and do your drawing inside setLayerProperties: method. drawRect: will not be