IOS image triangle and ios image triangle

Source: Internet
Author: User

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.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.