How to achieve the tableView section shadow in UITableViewController.
Add this method to get drop shadow of UITableView Section This answer is in 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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With