iOS 视图同时设置圆角和阴影
2019-06-10 本文已影响0人
梓华
参考
https://blog.csdn.net/crazy_sunshine/article/details/78029229
- (UIView *)workspaceIcon
{
if(_workspaceIcon == nil)
{
_workspaceIcon = [[UIView alloc] init];
_workspaceIcon.layer.shadowColor = [[UIColor blackColor] CGColor];
_workspaceIcon.layer.shadowRadius = 4;
_workspaceIcon.layer.shadowOpacity = 0.2;
_workspaceIcon.layer.shadowOffset = CGSizeMake(0, 3);
_workspaceIcon.layer.cornerRadius = 12.0;
}
return _workspaceIcon;
}
- (UIImageView *)workspaceIconImageView
{
if(_workspaceIconImageView == nil)
{
_workspaceIconImageView = [[UIImageView alloc] init];
_workspaceIconImageView.image = [UIImage imageNamed:@"pic_clock"];
_workspaceIconImageView.layer.cornerRadius = 12.0;
_workspaceIconImageView.layer.masksToBounds = YES;
}
return _workspaceIconImageView;
}