iPhone - is CGContextSetStrokeColorWithColor not creating wanted color?
I am having some weird troubles with drawing some lines in an application. My drawRect is using
CGContextRef context = UIGraphicsGetCurrentConte开发者_如何学Cxt();
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:57 green:172 blue:255 alpha:1].CGColor]);
CGContextSetAlpha(context, 0.8);
CGContextSetLineWidth(context, POLYLINE_WIDTH);
The color that is supposed to be shown is something like this. However I am getting a dark grey color, does anyone know why this color could be getting skewed?
Try
CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:57 / 255 green:172 / 255 blue:255 / 255 alpha:1].CGColor]);
These functions are expecting a number from 0-1.
精彩评论