1

Is there a simple way to apply a CoreImage filter to the content of a view? For example make a view look blurry?

Proud Member
  • 38,700
  • 43
  • 143
  • 225
  • I believe you can render your views calayer and then apply the filter to that image. – Simon May 27 '12 at 16:40
  • As a note, there are currently no blur filters in Core Image on iOS: http://stackoverflow.com/questions/8528726/does-ios-5-support-blur-coreimage-fiters – Brad Larson May 27 '12 at 22:21

1 Answers1

1

you can convert the UIView to UIImage and then apply CoreImage filters on it..

you can use the following code to convert it..

+ (UIImage *) imageWithView:(UIView *)view
{
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
    [view.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage * img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;
}

Source

Community
  • 1
  • 1
Ankit Srivastava
  • 11,975
  • 9
  • 57
  • 111