0

I have collectionView Cell In that i have this text,I want to blur the text as shown in image.

I have tried Using UIVisualEffect but i didnt get exact response.

Code: UIGraphicsBeginImageContext(self.bounds.size); [self.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: 10] forKey: @"inputRadius"];
    CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"];
    UIImage *endImage = [[UIImage alloc] initWithCIImage:resultImage];
    //Place the UIImage in a UIImageView
    UIImageView *newView = [[UIImageView alloc] initWithFrame:self.bounds];
    newView.image = endImage;
    [self addSubview:newView];
Diksha
  • 439
  • 7
  • 22
  • Post some of your code so we can have a look at what you've tried. – Haligen Jun 21 '16 at 12:34
  • @Haligen i have added UIVisualEffect in xib and also i have used Gaussian Blur and the code i have used is edited above – Diksha Jun 21 '16 at 13:04
  • Is each car model in your posted image an individual cell, or are they all in one cell, and where is your above code placed at? Custom cell class? View Controller Class? – Haligen Jun 21 '16 at 13:48
  • @Haligen it is custom cell in which all the models are individual cells respectively,Above code is placed in custom cell – Diksha Jun 21 '16 at 13:54
  • Is there any solution for this,am stucked here for many days..:( – Diksha Jul 18 '16 at 10:31

1 Answers1

0

Create an UIImage with Gaussian Blur and add image onto this textField or Button (whatever you have).