9
tôi đã tạo ra một tableViewController nơi tôi gọi chức năng này:Set gradient UITableView
func setTableViewBackgroundGradient(sender: UITableViewController ,let topColor:UIColor, let bottomColor:UIColor){
let gradientBackgroundColors = [topColor.CGColor, bottomColor.CGColor]
let gradientLocations = [0.0,1.0]
let gradientLayer = CAGradientLayer()
gradientLayer.colors = gradientBackgroundColors
gradientLayer.locations = gradientLocations
gradientLayer.frame = sender.tableView.bounds
sender.tableView.backgroundView?.layer.insertSublayer(gradientLayer, atIndex: 0)
}
với:
setTableViewBackgroundGradient(self, UIColor(0xF47434), UIColor(0xEE3965))
nhưng tất cả tôi nhận được là:
Yay, bạn đã lưu trong ngày của tôi, cảm ơn bạn rất nhiều! –
giải pháp rất đẹp, cảm ơn bạn –
màu ô cũng có thể được đặt trong bảng phân cảnh. –