【发布时间】:2015-08-28 11:17:14
【问题描述】:
使用 DrawRect 方法绘制一个矩形视图。我必须设置那个特定矩形视图的半径角。我已经写了在下面绘制一个矩形视图。
- (void)drawRect:(CGRect)rect {
int coordinate_x=60,coordinate_y=120,width=200,height=295;
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect drawTank = {coordinate_x, coordinate_y, width, height};
CGColorRef blackColor=[UIColor blackColor].CGColor;
CGContextSetRGBStrokeColor(context, 0, 0, 255, 1);
CGContextSetLineWidth(context, 1.0);
CGContextSetStrokeColorWithColor(context, blackColor);
CGContextStrokeRect(context, drawTank);
}
我必须使用下面的代码填充视图和空视图。
CGRect emptyTank = CGRectMake(coordinate_x, coordinate_y, width, height *(1-filledPercentage));
CGRect fullTank = CGRectMake(coordinate_x, coordinate_y+height *(1-filledPercentage),width, height * filledPercentage);
如何为特定视图设置半径角。请帮帮我。
提前致谢。
【问题讨论】:
标签: objective-c