我试图在我的iOS应用程序的表格视图中放置阴影。我尝试了不同的技术,但还没有设法解决它。我试图增加该小区本身的第一层上的阴影:在UITableView单元格上放置阴影不显示[Swift 3]
cell.layer.shadowColor = UIColor.black.cgColor
cell.layer.shadowOpacity = 1
cell.layer.shadowOffset = CGSize.zero
cell.layer.shadowRadius = 2
这并没有工作,所以我试图把盒子上影内容视图:
cell.contentview.layer.shadowColor = UIColor.black.cgColor
cell.contentview.layer.shadowOpacity = 1
cell.contentview.layer.shadowOffset = CGSize.zero
cell.contentview.layer.shadowRadius = 2
我还尝试在表视图单元格中添加具有相同约束的额外视图,并在该视图上放置阴影框,但这并未改变结果。 result with extra view and constraints and cornenradius
东西在表视图特别是以下内容:每节
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section != 0 {
return 10
} else {
return 0
}
}
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
let header = view as! UITableViewHeaderFooterView
header.tintColor = UIColor.init(netHex: 0xF9FAFD)
}
表视图的数据都放在单独的部分,和1排。
看到这个曾经http://stackoverflow.com/questions/43567288/uiview-shadow -cornerradius-not-working/43567400#43567400 –
我尝试过那里解释过的解决方案,但它没有效果。 –
可以更新问题一次 –