I’m looking to make a custom UIView subclass that has a “hole” in it through which the view below it is visible. I’ve already accomplished this using some Core Graphics drawing and clipping. Fun stuff.
I’d also like this view, which is called WheelDetailView, to have a drop shadow. Easy enough. I’ve accomplished that with something like:
[[self layer] setShadowColor:[[UIColor blackColor] CGColor]];
[[self layer] setShadowRadius:4.0];
[[self layer] setShadowOpacity:1.0];
[[self layer] setShadowOffset:CGSizeMake(0, 2)];
The problem is, this setup gives me a shadow inside the “hole” that I’ve created in my view. While I realize that this makes perfect sense, since you would expect to see a shadow there in real life, I’d prefer to only have the drop shadow appear around my view.
Here’s how it appears now:

I intentionally blurred part of the wheel for anonymity; you can ignore that.
As you can see, the shadow is present both outside the view and within it. Does anyone know of a good way to remove this effect?
Will it make sense to put the WheelView above the view?
Or you can remove the view’s shadow and use a separate view with shadow, then place it behind all the views
Or an image of shadow and place it behind all views