How to make Shadow effect for View or Button.. etc on 4 sides iOS objective c...
1)
Set masks bounds to NO to display shadow visible
_viewBg.layer.masksToBounds = NO;
Set shadow Color
_viewBg.layer.shadowColor = [[UIColor colorWithRed:0 green:0 blue:0 alpha:0.25f] CGColor];
Set Shadow radius
_viewBg.layer.shadowRadius = 5.0f; // values depends on View Size
1) Use following to add Shadow top, left of View
_viewBg.layer.shadowOffset = CGSizeMake(-2.0f, -2.0f); // values depends on View Size
2) Use following to add Shadow bottom, right of View
_viewBg.layer.shadowOffset = CGSizeMake(2.0f, 2.0f); // values depends on View Size
3) Use following to add Shadow top, left, bottom, right of View
_viewBg.layer.shadowOffset = CGSizeZero;
4) Set Shadow opacity to full
_viewBg.layer.shadowOpacity = 1.0f;
No comments:
Post a Comment