5
如何在UITableViewController中實現tableView剖面陰影。UITableView剖面陰影
如何在UITableViewController中實現tableView剖面陰影。UITableView剖面陰影
添加這種方法來獲得掉落的UITableView節 的陰影這個答案是Swift3
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let shadowView = UIView()
let gradient = CAGradientLayer()
gradient.frame.size = CGSize(width: myTab.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
}
試試這個http://stackoverflow.com/questions/13395362/shadow-around-a-section-of- uitableview?rq = 1 – dip
已經檢查過,它不會在區段中製作陰影..它會在區段標題中放置陰影 – nik
您想在區段標題中寫入這個陰影嗎?或在整個部分 – HardikDG