Get shadow for custom tableViewCell?

78 views Asked by At

I have a UITableView in UIViewController. I have multiple sections with only one row. How can i get shadow for cell like in next picture?

enter image description here

1

There are 1 answers

0
Thakkar Pari On

You need to enable the shadow to be created outside of the bounds;

[cell.layer setMasksToBounds:NO];

and then you need to set

[cell.layer setShadowOffset:CGSizeMake(0, 1)];
[cell.layer setShadowColor:[[UIColor darkGrayColor] CGColor]];
[cell.layer setShadowRadius:8.0];
[cell.layer setShadowOpacity:0.8];

return cell;

and if not success you can also try this solution.

iPhone UITableViewCell layer shadow

or you can also refer this tutorial for your reference.

Fun shadow effects using custom CALayer shadowPaths