UITableView Section Shadow

How to achieve shadow in tableView section in UITableViewController.

+5
source share
1 answer

Add this method to get the shadow for the change in the 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: 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 } 
+4
source

Source: https://habr.com/ru/post/1245904/


All Articles