ios - UITableViewCell Layer Shadow Overlap Cell 上面
问题描述
一切都在标题中。
我有一个带有单元格的 UITableView。单元格有一个阴影(self.layer.shadow ...)。
问题是一个单元格的阴影与上面的单元格重叠。我怎样才能防止这种行为?
这是我单元格中的代码:
self.layer.shadowColor = UIColor.gray.cgColor
self.layer.shadowOffset = .zero
self.layer.shadowOpacity = 0.15
self.layer.shadowRadius = 10
self.layer.cornerRadius = 8
backgroundColor = .white
解决方案
使用此代码添加阴影:-
self.layer.masksToBounds = false
self.layer.shadowOffset = CGSize(width: -1, height: 1)
self.layer.shadowOpacity = 0.2
self.layer.cornerRadius = 8
推荐阅读
- javascript - 在嵌入中禁用@everyone
- vba - 如何在文件资源管理器中打开一个单独的进程并使用 vba 进行搜索
- python - 如何从地下天气中提取表格
- r - 计算 mgcv::gam 中的方差(均方)之间和之内
- javascript - 谷歌图表垂直组合 vhaxis
- python - 具有多个参数的 MultiProcess 函数
- node.js - Meteor 构建与 Docker 构建一起挂起,但在容器内工作
- python - tensorflow gpu出现如下错误如何解决?
- c - 在 C 中以字节为单位查找总内存
- python - 解决 Python 程序的错误,不知道为什么会出现