擦除UIImageView

躍然發表於2015-09-22
// 橡皮擦擦除
- (void) eraseDrawing {
    UIGraphicsBeginImageContext(image.frame.size);//繪圖上文
    [image.image drawInRect:image.bounds];//繪圖大小
    CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectMake(eraseButtonImg.frame.origin.x+10, eraseButtonImg.frame.origin.y+10, 30, 30));//在當前image下繪製
    image.image = UIGraphicsGetImageFromCurrentImageContext(); //獲取最新得image 第一個image為UIImageView,第二個image為UIImage
    UIGraphicsEndImageContext();//繪圖下文
}

相關文章