CGContextRef

CGFloat minx = CGRectGetMinX(rect);
CGFloat midx = CGRectGetMidX(rect);
CGFloat maxx = CGRectGetMaxX(rect);

CGFloat miny = CGRectGetMinY(rect);
CGFloat midy = CGRectGetMidY(rect);
CGFloat maxy = CGRectGetMaxY(rect);

CGContextRef context=UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, minx, midy);

/* Top Left Corner */
CGContextAddArcToPoint(context, minx, miny, midx, miny, 10);

CGContextSetLineWidth(context, 1);
CGContextSetStrokeColorWithColor(context, [UIColor yellowColor].CGColor);//stroke颜色
//CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);//fill颜色
//CGContextAddRect(context, CGRectMake(0, 0, self.frame.size.width, self.frame.size.height));
//CGContextFillPath(context);// 画内容
CGContextDrawPath(context, kCGPathStroke);//画路径
//[@"love" drawInRect:CGRectMake(10, 10, 100, 100) withFont:[UIFont fontWithName:@"Arial" size:30]];//写字

你可能感兴趣的:(context)