2016-03-28 81 views
5

如何在UITableViewController中实现tableView剖面阴影。UITableView剖面阴影

+0

试试这个http://stackoverflow.com/questions/13395362/shadow-around-a-section-of- uitableview?rq = 1 – dip

+0

已经检查过,它不会在区段中制作阴影..它会在区段标题中放置阴影 – nik

+0

您想在区段标题中写入这个阴影吗?或在整个部分 – HardikDG

回答

3

添加这种方法来获得掉落的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 
}