How to create shadow effect on UIView?

Introduction on Shadow Effect on UIView

Shadow Effect make a UIElement different from whole screen and take a different look and attracts user directly at first sight and with this it looks good in design. To show different buttons with different or highlight UIButtons or UIView.

Shadow Effect on UIView

Overview for creating of Shadow Effect on UIView

Shadow effect look gives 3D effect to any element. It looks like that element is coming outward on screen and that makes it highlights than elements.

Code for creating of Shadow Effect on UIView

For making shadow of UIView and make shadow from every side of UIView you need write below code and add viewShadow this is UIView on which you are going to apply shadow effect.
viewShodow.layer.shadowRadius = 1.4f;
viewCheck.layer.masksToBounds = FALSE;
viewShodow.layer.shadowColor = [UIColor colorWithRed:144.f/255.f green:144.f/255.f blue:144.f/255.f alpha:1.f].CGColor;
viewShodow.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
viewShodow.layer.shadowOpacity = 0.8f;

UIEdgeInsets shadowInsets = UIEdgeInsetsMake(0, 0, -1.0f, 0);
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:UIEdgeInsetsInsetRect(viewShodow.bounds, shadowInsets)];
viewShodow.layer.shadowPath = shadowPath.CGPath;

Leave a Comment