Adding drop shadow to UITableView

前端 未结 4 2052
野趣味
野趣味 2020-12-30 03:41

I\'ve a plain UITableView (not grouped) that I want to add a dropshadow to left and to the right.

\"enter

4条回答
  •  自闭症患者
    2020-12-30 04:30

    Adding Swift version of solution (which helped me a lot) provided by @mattjgalloway

    your_TableView.clipsToBounds = false
    your_TableView..layer.masksToBounds = false
    your_TableView..layer.shadowColor = UIColor.lightGray.cgColor
    your_TableView..layer.shadowOffset = CGSize(width: 0, height: 0)
    your_TableView..layer.shadowRadius = 5.0
    your_TableView..layer.shadowOpacity = 0.5
    

提交回复
热议问题