btn.layer.shadowColor = UIColor.blackColor().CGColor
btn.layer.shadowOffset = CGSizeMake(5, 5)
btn.layer.shadowRadius = 5
btn.layer.shadowOpacity = 1
一定要指定shadowOpacity,因为其默认值为0,如果为0,就不会显示任何效果
btn.layer.shadowColor = UIColor.blackColor().CGColor
btn.layer.shadowOffset = CGSizeMake(5, 5)
btn.layer.shadowRadius = 5
btn.layer.shadowOpacity = 1
一定要指定shadowOpacity,因为其默认值为0,如果为0,就不会显示任何效果
转载于:https://www.cnblogs.com/JimmyBright/p/4372062.html