サブクラス化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);