IOS作图画三角形
by 伍雪颖
const CGFloat *color=CGColorGetComponents(popUpColor.CGColor); UIGraphicsBeginImageContext(CGSizeMake(30, 20)); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(ctx, color[0], color[1], color[2], 1); CGContextSetShadowWithColor(ctx, CGSizeMake(0, 0), 7.0, [UIColor blackColor].CGColor); CGPoint points[3] = { CGPointMake(15, 20), CGPointMake(25, 0), CGPointMake(5,0)}; CGContextAddLines(ctx, points, 3); CGContextClosePath(ctx); CGContextFillPath(ctx); UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext();
时间: 2024-10-21 06:39:01