I am trying to add some shadows to one of my representations, and what I would like to achieve is to draw shadows on one side only and let them have sharp edges. No. I tried several methods with no luck (using the shadow-related properties of CALayer + UIBezierPaths). However, iOS always creates a shadow with soft edges:

But what I really want to achieve is something like this (without round corners and sharp edges on the sides , except for one ):

Is there any elegant way to do this, or will I have to draw the shadow myself using CoreGraphics?
PS: I forgot to mention, my view should be a normal UIButton, so overriding drawRect: it will be painful here
source
share