【发布时间】:2015-05-03 18:56:04
【问题描述】:
我创建了一个 tableViewController 来调用这个函数:
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)
}
与:
setTableViewBackgroundGradient(self, UIColor(0xF47434), UIColor(0xEE3965))
但我得到的只是:
【问题讨论】:
标签: ios uitableview swift gradient