UIGraphicsContext创建一个圆角CGRect

时间:2014-03-04 10:06:56

标签: xcode uigraphicscontext

我正在使用此代码创建一个带文本的填充矩形并将其添加到图像

CGRect textRect = CGRectMake(0, p_point.y, p_image.size.width+15, p_image.size.height+10)    
[[UIColor colorWithRed:(70/255.0) green:(70/255.0) blue:(70/255.0) alpha:1] set];
CGContextFillRect(UIGraphicsGetCurrentContext(), textRect);
[[UIColor whiteColor] set];
[p_text drawInRect:textRect withFont:font lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

我希望矩形有圆角...

0 个答案:

没有答案