void CGContextAddRoundRect(CGContextRef context,CGRect rect,CGFloat radius){
float x1=rect.origin.x;
float y1=rect.origin.y;
float x2=x1+rect.size.width;
float y2=y1;
float x3=x2;
float y3=y1+rect.size.height;
float x4=x1;
float y4=y3;
CGContextMoveToPoint(context, x1, y1+radius);
CGContextAddArcToPoint(context, x1, y1, x1+radius, y1, radius);
CGContextAddArcToPoint(context, x2, y2, x2, y2+radius, radius);
CGContextAddArcToPoint(context, x3, y3, x3-radius, y3, radius);
CGContextAddArcToPoint(context, x4, y4, x4, y4-radius, radius);
CGContextClosePath(context);
}
CGContext画圆角矩形的函数
最新推荐文章于 2023-03-15 20:17:26 发布