Is there a simple way to apply a CoreImage filter to the content of a view? For example make a view look blurry?
Asked
Active
Viewed 1,027 times
1
-
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 Answers
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;
}
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/919545.webp)
Ankit Srivastava
- 11,975
- 9
- 57
- 111