【发布时间】:2020-02-20 03:06:47
【问题描述】:
我目前在 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
【问题讨论】:
-
确保您的 tableView 单元格高度等于或大于您的
collectionView cell height + your shadow radius。
标签: ios swift uitableview uicollectionview uikit