0

I have a map view inside a cell and I want it to have corner radius and shadow. I either get only rounded corners OR only the shadow and no rounder corners when i set masks to bounds ON/OFF respectively. I looked up to this example: Can't add a corner radius and a shadow

but with no success. What am I missing? thank you in advance!

[[cell.map1 layer] setShadowColor:[UIColor blackColor].CGColor];
[[cell.map1 layer] setShadowOpacity:0.8f];
[[cell.map1 layer] setShadowRadius:20.0f];
[[cell.map1 layer] setShadowOffset:CGSizeMake(0, 3)];
       // [[cell.map1 layer] setMasksToBounds:NO];
[[cell.map1 layer] setShouldRasterize:YES];
[[cell.map1 layer] setCornerRadius:20];
Community
  • 1
  • 1
user1780591
  • 207
  • 4
  • 14
  • why have you commented [[cell.map1 layer] setMasksToBounds:NO];? – P.J Feb 08 '13 at 12:41
  • I was just testing the possible solutions. It doesn't work when I set it to YES or NO. It either shows only the shadow or only makes the corners rounded – user1780591 Feb 08 '13 at 12:49

1 Answers1

0

Setting mask to bounds is like setting clip to bounds. This means nothing can be outside the bounds and the shadow lays outside of the bounds. Check out this post.

Community
  • 1
  • 1
Jaybit
  • 1,864
  • 1
  • 13
  • 20