IOS image triangle and ios image triangle
IOS image triangle by Wu xueying
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();
How does iOS use a program to draw triangles?
This code can be implemented:-(void) drawRect :( CGRect) rect {CGContextRef ctx = forward (); CGContextBeginPath (ctx); CGContextMoveToPoint (ctx, CGRectGetMinX (rect ), CGRectGetMinY (rect); // top left trim (ctx, CGRectGetMaxX (rect), CGRectGetMidY (rect); // mid right CGContextAddLineToPoint (ctx, CGRectGetMinX (rect ), CGRectGetMaxY (rect); // bottom left CGContextClosePath (ctx); CGContextSetRGBFillColor (ctx, 1, 1, 0, 1); CGContextFillPath (ctx);} To DEVDIV. view Response Details on the COM website>
How to use a ruler to draw the midline and height of a triangle
Midline painting of an edge: draws an arc with one end of the edge as the center and the length as the radius.
Take the other end of this edge as the center, and the length is the radius. Then draw an arc,
You can get the two intersections of the arc, and connect the two midpoint, that is, the vertical split line of this edge.
The midpoint of this edge is found, and the other vertex in the link is the midline.
High painting method: in the Triangle ABC, AC <AB, with A as the center, AC as the radius, as the arc, BC at D
The vertical split line for CD is the height of the BC side.