Swift3.0 shadowColor

来源:互联网 发布:php最新面试题 编辑:程序博客网 时间:2024/06/07 14:25
self.contentView.layer.shadowColor = UIColor.blue.cgColorself.contentView.layer.shadowOffset = CGSize.init(width: 4, height: 4)self.contentView.layer.shadowOpacity = 0.8self.contentView.layer.shadowRadius = 4

我写的时候这样写,看这没有任何问题,就是不出现效果,然后仔细想想应该是没有borderWidth的问题,依稀记得之前OC犯过这个错误,结果加上之后效果马上出现了。

self.contentView.layer.borderWidth = 1        self.contentView.layer.borderColor = UIColor.white.cgColor        self.contentView.layer.shadowOffset = CGSize.init(width: 4, height: 4)        self.contentView.layer.shadowRadius = 4
0 0
原创粉丝点击