简体   繁体   中英

What's the difference between CGContextSetStrokeColorWithColor UIColor setStroke?

Is there any difference between those two ways of setting stroke color?

CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor)

[[UIColor redColor] setStroke]

Example

CGContextRef cr = UIGraphicsGetCurrentContext();

CGContextSetStrokeColorWithColor(cr, [UIColor redColor].CGColor);
[[UIColor redColor] setStroke];

UIBezierPath *bp = [UIBezierPath new];

[bp stroke];

UIGraphicsEndImageContext();

One is longer and pure C. The other is shorter and uses Objective-C. They have the same effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM