In the magazine, I read some useful extensions for the UIView class. You can add a border with an angular radian or shadow for any UIView.
@implementation UIView (Extentions)
-(void) enableRoundRectsWithValue:(float)value
{
self.layer.masksToBounds = true;
self.layer.cornerRadius = value;
}
-(void) enableShadow
{
self.layer.masksToBounds = false;
self.layer.shadowOffset = CGSizeMake(0,2);
self.layer.shadowOpacity = 0.5;
}
@end
Although these methods work great for themselves, they do not play well together. I have no angular radius and shadow. At least not as you expect. I assume that masksToBounds is set to true in one method and false in another.
How can I get a UIView with a corner radius as well as a shadow (with the same corner radius)?
source
share