【发布时间】:2012-03-21 09:58:01
【问题描述】:
在“-(void)drawRect:(CGRect)rect”方法内的 UIView 中。 我想画一条普通的黑线(作为边框),但我总是得到一条半透明的线。 只有角落的四个点是完全黑色的。 这是为什么呢?
这是我的代码:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetAlpha(context,1.0);
CGContextSetRGBStrokeColor(context,0.0,0.0,0.0,1.0);
CGContextMoveToPoint(context,0.0,0.0);
CGContextAddLineToPoint(context,rect.size.width,0.0);
CGContextAddLineToPoint(context,rect.size.width,rect.size.height);
CGContextAddLineToPoint(context,0.0,rect.size.height);
CGContextClosePath(context);
CGContextStrokePath(context);
}
【问题讨论】: