【发布时间】:2016-07-15 08:44:06
【问题描述】:
我正在尝试为UITableViewCell.selectedBackgroundView 添加阴影效果,但这没有显示。当我设置背景颜色时,我可以看到它被添加了,所以我在设置阴影时做错了。这是我在cellForRowAtIndexPath下面的代码。
///Setting selected UIView
let selectedView = UIView(frame: cell.frame)
selectedView.layer.shadowOpacity = 0.35
selectedView.layer.shadowOffset = CGSizeMake(0, 2)
selectedView.layer.shadowRadius = 5
selectedView.layer.shadowColor = UIColor.blackColor().CGColor
selectedView.clipsToBounds = false
cell.selectedBackgroundView = selectedView
cell.contentView.clipsToBounds = false
cell.clipsToBounds = false
【问题讨论】:
-
试过把它放在 didselectrowAtIndexPath 中吗?
-
我认为阴影被下一个单元格隐藏了......
-
@Happiehappie 现在尝试了,但仍然没有成功
-
@Lumialxk 如何测试他的?
-
您可以添加具有清晰颜色的单元格来进行测试。
标签: ios arrays uitableview uiview