简体   繁体   English

自定义UITableViewCell阴影消失

[英]Custom UITableViewCell shadow disappears

I have a custom UITableViewCell created in a xib that contains an "inner" view that I set a shadow on. 我在xib中创建了一个自定义UITableViewCell,它包含一个设置了阴影的“内部”视图。 I set the shadow in tableView willDisplayCell and it works initially 我在tableView willDisplayCell中设置阴影,它最初可以工作

The problem is, when I scroll down, then back up, the shadow is gone (EDIT: it reappears when reloadData is called). 问题是,当我向下滚动然后向上备份时,阴影消失了(编辑:调用reloadData时,它会再次出现)。 What is happening here? 这是怎么回事 Why isn't my shadow always shown? 为什么不总是显示我的影子?

More info: 更多信息:

  • I've tried setting the shadow in cellForRowAtIndexPath: and I get the same result. 我尝试在cellForRowAtIndexPath中设置阴影:并且得到相同的结果。
  • I'm setting the cells selectionStyle and backgroundColor just prior to setting the shadow. 我在设置阴影之前设置单元格selectionStyle和backgroundColor。
  • I'm also curving the edge of the inner view just before setting the shadow (and this works all the time.. even after scrolling). 我还在设置阴影之前弯曲了内部视图的边缘(这一直都有效,即使滚动后也是如此)。
  • My tableView is in a storyboard and I register the custom cell nib in my view controllers viewDidLoad. 我的tableView在情节提要中,我在视图控制器viewDidLoad中注册了自定义单元格笔尖。

To debug, I increased the size of the curved edge and I can see that the shadow is still shown, but the bottom of my view is being clipped.. 为了进行调试,我增加了弯曲边缘的大小,可以看到阴影仍然显示,但是视图的底部被裁剪了。

Looks like there is a bad or missing constraint somewhere.. 看起来某处存在不良约束或缺失约束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM