In some code snippet
- (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
CGContextSetFillColorWithColor(ctx, [[UIColor darkTextColor] CGColor]);
UIGraphicsPushContext(ctx);
...
the current fill color is set, then the state is pushed to the stack. Other snippet:
- (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
UIGraphicsPushContext(ctx);
[[UIColor darkTextColor] set];
...
Which way is correct? what's is the difference between those 2 methods CGContextSetFillColorWithColor
and UIColor set
in terms of state management?