我有一个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?
}