1
votes

I have a custom UITableViewCell created in a xib that contains an "inner" view that I set a shadow on. I set the shadow in tableView willDisplayCell and it works initially

The problem is, when I scroll down, then back up, the shadow is gone (EDIT: it reappears when reloadData is called). 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.
  • I'm setting the cells selectionStyle and backgroundColor just prior to setting the shadow.
  • 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.
1
Apple recommends to use CGPath (rather than just shadowOffset to improve shadow drawing performance. Did you try this? - Mundi
Yep, I've tried using CGPath.. still happens - Swanson
Consider using an image - that should perform better in any case. - Mundi
looks like it wasnt a performance issue.. a bad constraint was clipping the bottom of my view (i.e. clipping the shadow) - Swanson

1 Answers

0
votes

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..