iphone - how to erase subviews from a view? -


This is my code, I'm just using this code to erase imageView.image But I want to erase the image viewbacks. How can I erase the subviews from the image view?

  UIGraphicsBeginImageContext (imageView.frame.size); [ImageView.image drawInRect: CGRectMake (0, 0, imageView.frame.size.width, imageView.frame.size.height)]; CGContextSetLineCap (UIGraphicsGetCurrentContext (), kCGImageAlphaNone); // kCGImageAlphaPremultipliedLast); CGContextSetLineWidth (UIGraphicsGetCurrentContext (), 10); CGContextSetRGBStrokeColor (UIGraphicsGetCurrentContext (), 1, 0, 0, 10); CGContextBeginPath (UIGraphicsGetCurrentContext ()); CGContextMoveToPoint (UIGraphicsGetCurrentContext (), point.x, point.y); // To remove this line, select the part of the image image CGContextClearRect (UIGraphicsGetCurrentContext (), CGRectMake (point.x, point.y, 30, 30)); // End code CGContextStrokePath (UIGraphicsGetCurrentContext ()); ImageView.image = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext ();    

Did you just use [imageView removeFromSuperview] have tried?

Comments