#import "drawpicture.h"
@implementation drawpicture
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, 100, 100);
// CGContextAddLineToPoint(context, 100, 100);
// CGContextAddRect(context,CGRectMake(100, 100, 200, 100));
CGContextAddEllipseInRect(context, CGRectMake(125, 125, 50, 50));
//画边框
// CGContextStrokePath(context);
//只填充
// CGContextFillPath(context);
//设置填充色
// [[UIColor redColor] setFill];
[[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5] setFill];
//设置边框颜色
// [[UIColor blueColor] setStroke];
// [[UIColor greenColor] set];
//EVEN-ODD, 奇偶规则填充
CGContextDrawPath(context, kCGPathEOFillStroke);
// CGContextMoveToPoint(context, 200, 200);
// CGContextAddArc(context, 100, 200, 100, 0, M_PI_2, 0);
// CGContextAddLineToPoint(context, 0, 100);
//control point
//CGContextAddCurveToPoint(context, 50, 0, 50, 200, 100, 100);
// CGContextAddQuadCurveToPoint(context, 150, 0, 200, 100);
CGContextAddRect(context,CGRectMake(100, 100, 150, 100));
CGContextStrokePath(context);
}
@end