美文网首页
iOS 视图同时设置圆角和阴影

iOS 视图同时设置圆角和阴影

作者: 梓华 | 来源:发表于2019-06-10 14:35 被阅读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;
    }
    
    

    相关文章

      网友评论

          本文标题:iOS 视图同时设置圆角和阴影

          本文链接:https://www.haomeiwen.com/subject/vujzxctx.html