我有以下代码:
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGFloat commentHeight = 0;
CGSize commentSize = [self.highlightItem_.comment sizeWithFont:[UIFont fontWithName:kProximaNova size:18] constrainedToSize:CGSizeMake(rect.size.width, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
commentHeight = commentSize.height + 50;
CGContextSetRGBStrokeColor(context, 68/255.f, 68/255.f, 68/255.f, 1.0);
CGContextSetRGBFillColor(context, 68/255.f, 68/255.f, 68/255.f, 1.0);
CGContextSetLineJoin(context, kCGLineCapSquare);
CGContextSetLineWidth(context, 1.0);
CGMutablePathRef pathRef = CGPathCreateMutable();
CGPathMoveToPoint(pathRef, NULL, 0, rect.size.height - commentHeight);
CGPathAddLineToPoint(pathRef, NULL, 20, rect.size.height - commentHeight);
CGPathAddLineToPoint(pathRef, NULL, 25, rect.size.height - commentHeight - 10);
CGPathAddLineToPoint(pathRef, NULL, 30, rect.size.height - commentHeight);
CGPathAddLineToPoint(pathRef, NULL, rect.size.width, rect.size.height - commentHeight);
CGPathAddLineToPoint(pathRef, NULL, rect.size.width, rect.size.height);
CGPathAddLineToPoint(pathRef, NULL, 0, rect.size.height);
CGPathCloseSubpath(pathRef);
CGContextAddPath(context, pathRef);
//CGContextFillPath(context);
CGContextDrawPath(context, kCGPathFill);
CGPathRelease(pathRef);
}
由于某种原因,它没有画出我想要的形状。事实上它什么也没画。有什么我做错了吗?