OL
Size: a a a
OL
BS
BS
OL
A
button.layer.masksToBounds = true. Что не так? как вернуть тень?A
BS
BS
gradient.masksToBounds = trueBS
AK
button.layer.masksToBounds = true. Что не так? как вернуть тень?AK
self.layer.masksToBounds = false
self.layer.cornerRadius = self.frame.height/2
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: self.layer.cornerRadius).cgPath
self.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
self.layer.shadowOpacity = 0.5
self.layer.shadowRadius = 1.0AK
BS
BS
self.layer.masksToBounds = false
self.layer.cornerRadius = self.frame.height/2
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: self.layer.cornerRadius).cgPath
self.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
self.layer.shadowOpacity = 0.5
self.layer.shadowRadius = 1.0BS
BS
shadow(button: UIButton) {
button.layer.shadowColor = UIColor(displayP3Red: 92/255, green: 108/255, blue: 247/255, alpha: 1).cgColor
button.layer.cornerRadius = button.frame.height / 4
button.layer.shadowPath = UIBezierPath(roundedRect: button.bounds, cornerRadius: button.layer.cornerRadius).cgPath
button.layer.shadowRadius = 5
button.layer.shadowOpacity = 0.5
button.layer.shadowOffset = CGSize(width: 5, height: 5)
button.layer.masksToBounds = false
}
func buttonGradientBackground(button: UIButton, firstColor: UIColor, secondColor: UIColor) {
let gradient = CAGradientLayer()
gradient.colors = [firstColor.cgColor, secondColor.cgColor]
gradient.frame = button.bounds
gradient.startPoint = CGPoint(x: 0, y: 0)
gradient.endPoint = CGPoint(x: 1, y: 1)
button.layer.insertSublayer(gradient, at: 0)
button.clipsToBounds = true
}A
shadow(button: UIButton) {
button.layer.shadowColor = UIColor(displayP3Red: 92/255, green: 108/255, blue: 247/255, alpha: 1).cgColor
button.layer.cornerRadius = button.frame.height / 4
button.layer.shadowPath = UIBezierPath(roundedRect: button.bounds, cornerRadius: button.layer.cornerRadius).cgPath
button.layer.shadowRadius = 5
button.layer.shadowOpacity = 0.5
button.layer.shadowOffset = CGSize(width: 5, height: 5)
button.layer.masksToBounds = false
}
func buttonGradientBackground(button: UIButton, firstColor: UIColor, secondColor: UIColor) {
let gradient = CAGradientLayer()
gradient.colors = [firstColor.cgColor, secondColor.cgColor]
gradient.frame = button.bounds
gradient.startPoint = CGPoint(x: 0, y: 0)
gradient.endPoint = CGPoint(x: 1, y: 1)
button.layer.insertSublayer(gradient, at: 0)
button.clipsToBounds = true
}BS
BS
BS