我使用CGContext在UIImageView中畫手繪線。下面的代碼:
UIGraphicsBeginImageContext(self.frame.size);CGContextRef context= UIGraphicsGetCurrentContext();
但是畫在ImageView中,圖的尺寸就變成了ImageView的大小,我還要在調整成原來的尺寸,調整之後圖片就失真了。能不能跳過imageView直接在圖中畫?而且必須要imageView適應圖片,這樣能畫線。幫幫忙~
你要在線條圖的頂部重新渲染:
- (UIImage *)renderImage:(UIImage *)image atSize:(CGSize)size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0.0, 0.0, size.width, size.height)];
UIImage *newImage=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}