I have an UIImage
which I want to draw on a UIView
. But instead of creating an UIImageView
and adding this as a subview, I want to overwrite -drawRect:
and draw my UIView directly.
For example, my code looks like:
- (void)drawRect:(CGRect)rect {
CGContextRef myContext = UIGraphicsGetCurrentContext();
UIImage *img = [UIImage imageNamed:@"foo.png"];
// how to draw the directly into the view now?
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…