Jak narysować UIImage lub bezpośrednio w drawRect :?
mamUIImage
które chcę narysowaćUIView
. Ale zamiast tworzyćUIImageView
i dodając to jako podgląd, chcę nadpisać-drawRect:
i narysuj bezpośrednio mój UIView.
Na przykład mój kod wygląda tak:
- (void)drawRect:(CGRect)rect {
CGContextRef myContext = UIGraphicsGetCurrentContext();
UIImage *img = [UIImage imageNamed:@"foo.png"];
// how to draw the directly into the view now?
}