9
Ho creato un tableViewController dove sto chiamando questa funzione:Set gradiente dietro 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)
}
con:
setTableViewBackgroundGradient(self, UIColor(0xF47434), UIColor(0xEE3965))
ma tutto quello che ottiene è questo:
Yay, mi hai salvato la giornata, grazie mille! –
soluzione molto bella, grazie –
il colore della cella può anche essere impostato nello storyboard. –