I need to draw the blur effect on the UIView using Objective C.
Here is my design
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle: UIBlurEffectStyleExtraLight];
UIVisualEffectView *contentView = [[UIVisualEffectView alloc] initWithEffect: blurEffect];
contentView.layer.cornerRadius = 18.0;
contentView.layer.masksToBounds = YES;
contentView.backgroundColor = [UIColor whiteColor];
contentView.userInteractionEnabled = NO;
contentView.layer.shadowRadius = 10;
contentView.layer.shadowOpacity = 0.2f;
contentView.layer.shadowColor = [UIColor whiteColor].CGColor;
contentView.layer.shadowOffset = CGSizeZero;
[contentView setFrame: annotationFrame];
[contentView setTranslatesAutoresizingMaskIntoConstraints: YES];
self.contentView = contentView;
below screenshot was current output using the above code
I have tried the above code. , but I didn't get the exact blur effect kindly suggest me to draw this design.
I have updated the below code
- (void)drawRect:(CGRect)rect {
[super drawRect: rect]; //i doubt we need a super drarRect here…
[self drawMarker: self.markerView fillColor: [UIColor whiteColor]];
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGPathRef path = CGPathCreateWithRoundedRect(CGRectInset(rect, self.frame.size.width/4, self.frame.size.height/4), self.frame.size.width/8, self.frame.size.height/8, nil);
CGContextSetFillColorWithColor(ctx,[UIColor slateColor].CGColor);
CGContextSetShadowWithColor(ctx, CGSizeZero, self.frame.size.height/4, [UIColor slateColor].CGColor);
for ( int i = 0; i<=6; i++) {
CGContextAddPath(ctx, path);
CGContextFillPath(ctx);
}
}
I need the blur effect behind my view , kindly advice the me regarding this.
Thank you.