Set Background Gradient on Button in Swift
问题 I have no idea how to set the background gradient on a button (without making the background gradient an image). This is so different from Android. Here's a class I have to define a returnable gradient scheme: import UIKit extension CAGradientLayer { func backgroundGradientColor() -> CAGradientLayer { let topColor = UIColor(red: (0/255.0), green: (153/255.0), blue:(51/255.0), alpha: 1) let bottomColor = UIColor(red: (0/255.0), green: (153/255.0), blue:(255/255.0), alpha: 1) let gradientColors