Как эффект размытия применить на UIView в iOS?

В моем приложении я хочу применить эффект размытия на uiview.Так как я могу добиться эффекта размытия. Я попробовал ниже код:

UIGraphicsBeginImageContext(scrollview.bounds.size);
[scrollview.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

//Blur the UIImage with a CIFilter
CIImage *imageToBlur = [CIImage imageWithCGImage:viewImage.CGImage];
CIFilter *gaussianBlurFilter = [CIFilter filterWithName: @"CIGaussianBlur"];
[gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"];
[gaussianBlurFilter setValue:[NSNumber numberWithFloat:3] forKey: @"inputRadius"];
CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"];
UIImage *endImage = [[UIImage alloc] initWithCIImage:resultImage];

//Place the UIImage in a UIImageView
UIImageView *newView = [[UIImageView alloc] initWithFrame:scrollview.bounds];
newView.image = endImage;
[scrollview addSubview:newView];

Но возникли проблемы с использованием этого кода. При применении эффекта размытия время просмотра стало небольшим.

Ответы на вопрос(2)

Ваш ответ на вопрос