给view添加阴影边框的代码:
self.contentBackView.layer.shadowColor = RGBA(204, 204, 204, 1).CGColor;
// 阴影偏移,默认(0, -3)
self.contentBackView.layer.shadowOffset = CGSizeMake(0,0);
// 阴影透明度,默认0
self.contentBackView.layer.shadowOpacity = 0.5;
// 阴影半径,默认3
self.contentBackView.layer.shadowRadius = 5;
效果如图:

网友评论