ios - 如何让我的 UICollectionViewCell 阴影渗入我的主视图?
问题描述
我目前在 UITableViewCell 中有一个 UICollectionView(水平)。我想为集合视图单元格添加一个阴影,但是由于 tableview 单元格的高度,阴影被切断了。有什么办法可以让影子流血吗?
(可能很难从这张图片中分辨出来,但它的顶部和底部都被切断了)
我有一个剪辑到 CVCell 边界的“背景”,
background.backgroundColor = .white
background.layer.cornerRadius = 8
background.layer.shadowColor = UIColor.black.cgColor
background.layer.shadowRadius = 7
background.layer.shadowOpacity = 0.3
background.layer.shadowOffset = CGSize(width: 0, height: 3)
background.layer.masksToBounds = true
background.clipsToBounds = false
在我的 UITableViewCell (不是具有背景的单元格)中,我设置了
cell.layer.masksToBounds = false
cell.clipsToBounds = true
解决方案
请检查collectionView
单元格的顶部和按钮约束设置。
推荐阅读
- c - 了解 Modbus RTU CRC
- python - tkinter:调用消息框后无法输入
- python - 我的数独求解程序进入无限循环,我不明白为什么 [python]
- swift - 在将值分配给 Swift 语言的属性之前,我们如何验证和调整值?
- javascript - ERROR TypeError: undefined is not an object (evalating 'this.props.navigation.navigate') when import my component in child
- flutter - m1 Mac 上的颤振插件显示错误“未找到模块 'foo'”
- swift - 在奇怪的行为中比较角度和向上
- python - 是否可以将 POST 请求中的视频读入 python-ffmpeg 或 OpenCV?
- python - Python pydantic 范围验证
- node.js - Dockerfile 应该执行“npm install”和“npm run build”还是应该只复制这些文件?