【发布时间】:2009-11-02 21:27:39
【问题描述】:
我有一个UIImage,我想在UIView 上绘制它。但是我不想创建UIImageView 并将其添加为子视图,而是要覆盖-drawRect: 并直接绘制我的 UIView。
例如,我的代码如下所示:
- (void)drawRect:(CGRect)rect {
CGContextRef myContext = UIGraphicsGetCurrentContext();
UIImage *img = [UIImage imageNamed:@"foo.png"];
// how to draw the directly into the view now?
}
【问题讨论】:
标签: iphone cocoa-touch uiimage drawrect