【发布时间】:2018-06-22 13:00:50
【问题描述】:
当我使用 CAGradientLayer 设置按钮时,它没有正确显示。
func setGradientBackground(color_A: UIColor, color_B: UIColor, indexLayer : Int){
let granderLayer = CAGradientLayer()
granderLayer.frame = bounds
granderLayer.colors = [color_A.cgColor, color_B.cgColor]
granderLayer.locations = [0.0, 1.0]
granderLayer.startPoint = CGPoint(x: 1.0, y: 1.0)
granderLayer.endPoint = CGPoint(x: 0.0, y: 0.0)
layer.insertSublayer(granderLayer, at: UInt32(indexLayer))
}
在滚动后的 UITableView 的情况下,这是可行的
【问题讨论】: