美文网首页
iOS开发-设置UIView阴影效果及圆角

iOS开发-设置UIView阴影效果及圆角

作者: 香蕉你个菠萝 | 来源:发表于2017-06-12 17:13 被阅读79次

要实现以下UI效果:

1222.png

直接贴代码

-(UIView *)bgView{

    if (!_bgView) {
        _bgView = [[UIView alloc]init];
        _bgView.layer.shadowColor = RGB(0, 0, 0).CGColor;
        _bgView.layer.shadowOpacity = 0.11f;
        _bgView.layer.shadowRadius = 3.f;
        _bgView.layer.shadowOffset = CGSizeMake(3, 3);
        _bgView.backgroundColor = [UIColor whiteColor];
        
        _bgView.layer.cornerRadius = 6;
//        _bgView.layer.masksToBounds = YES;
    }
    return _bgView;
}

效果就出来了

屏幕快照 2017-06-12 下午5.11.31.png

圆角设置大了 哈哈 再微调下 希望对你们有帮助

相关文章

网友评论

      本文标题:iOS开发-设置UIView阴影效果及圆角

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