我继承UIView,我覆盖-drawRect:,我画一个图CGContext。现在我想用 填充这个数字UIImage。知道怎么做吗?
编辑:
我的代码来自-drawRect:
CGContextBeginPath(ctx);
//here I draw my figure
CGContextClosePath(ctx);
CGContextClip(ctx);
//this doesn't work
UIImage * image = [UIImage imageNamed:@"blackbackground.jgp"];
[image drawInRect:rect];
//this neither
CGImageRef cgImage = image.CGImage;
CGContextDrawImage(ctx, rect, cgImage);