¿Cómo dibujar un UIImage o directamente en -drawRect :?
Yo tengo unUIImage
que quiero dibujar en unUIView
. Pero en lugar de crear unUIImageView
y agregando esto como una subvista, quiero sobrescribir-drawRect:
y dibujar mi UIView directamente.
Por ejemplo, mi código se ve como:
- (void)drawRect:(CGRect)rect {
CGContextRef myContext = UIGraphicsGetCurrentContext();
UIImage *img = [UIImage imageNamed:@"foo.png"];
// how to draw the directly into the view now?
}