2 mapmapm MapMapM 于 2013.01.11 17:07 提问

给CGMutableRefPath添加边框颜色

drawRect的代码如下:

 CGMutablePathRef pathRef = CGPathCreateMutable();
     CGPathMoveToPoint(pathRef, NULL, 0, 220);
     CGPathAddLineToPoint(pathRef, NULL, rect.size.width, 220);
     CGPathAddLineToPoint(pathRef, NULL, rect.size.width, rect.size.height);
     CGPathAddLineToPoint(pathRef, NULL, 0, rect.size.height);
     CGPathCloseSubpath(pathRef);

如何添加黑色的边框和圆角?

1个回答

garaster
garaster   2013.01.11 17:47

确保有context:

CGContextRef context = UIGraphicsGetCurrentContext();

然后

aColor = [UIColor blackColor];
[aColor setStroke];
CGContextSetLineWidth(context, 2.0f);
CGContextAddPath(context, pathRef);
CGContextStrokePath(context);
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!