添加此方法以获取UITableView节的阴影此答案在Swift3中
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let shadowView = UIView()
let gradient = CAGradientLayer()
gradient.frame.size = CGSize(width: tableView.bounds.width, height: 15)
let stopColor = UIColor.gray.cgColor
let startColor = UIColor.white.cgColor
gradient.colors = [stopColor, startColor]
gradient.locations = [0.0,0.8]
shadowView.layer.addSublayer(gradient)
return shadowView
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3514 次 |
| 最近记录: |