【发布时间】:2012-03-10 02:16:42
【问题描述】:
我正在寻找一种方法来绘制可拉伸图像作为我的自定义单元格背景视图的背景。我想使用 drawRect 方法并绘制一个完全拉伸的图像,就像它在 UIImageView 中用stretchableImageWithLeftCapWidth 拉伸一样......我怎样才能继续这段代码来实现它?
- (void)drawRect:(CGRect)rect{
CGContextRef context = UIGraphicsGetCurrentContext();
UIImage *bgImg =[[UIImage imageNamed:@"bg_table_top"]stretchableImageWithLeftCapWidth:3 topCapHeight:0];
//How to draw the image stretched as the self.bounds size ?
....
}
【问题讨论】:
标签: ios core-graphics