I have to create a custom UIView that will have round corners, a border, a shadow and its drawRect() method is overridden to provide custom drawing
In addition to the Frederic Adda's solution, don't forget to position the view that has shadow with a padding to the superview, where the shadow can be drawn. Otherwise the shadow will be clipped off. I made this mistake in my custom cell, and thought the solution was wrong until I added a padding of 8px all around.