我有這樣的代碼在視圖中的顏色:IOS:在一個視圖中繪製的圖像
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:drawImage];
UIGraphicsBeginImageContext(drawImage.frame.size);
[drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), size);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), r, g, b, a);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
CGContextStrokePath(UIGraphicsGetCurrentContext());
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我的問題是,我想有一點不變色,但我想用一個特定的形象,被重複(作爲PNG圖像) 可能嗎?
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@「image.png」]]; – Hanuman 2012-04-13 10:31:32
你能解釋一下嗎? – CrazyDev 2012-04-13 10:33:48