首页 > 代码库 > IOS作图画三角形

IOS作图画三角形

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();


IOS作图画三角形