I have long searched for a solution on the Internet. Most tutorials are pretty easy to add shadow to a UIView. I also noticed that if we add a shadow to the UIImageView. The shape of the shadow can perfectly match the shape of the content of the image if there is an alpha channel in the image itself. Say, for example, if the image is an animal with a transparent background, the shadow shape is also the same as that of the animal (and not a rectangular shadow, the same as the UIImageView frame).
But this is not enough. What I need to do is add some changes to the shadow so that it can have some rotation angle and a squeezed (squeezed or shifted) effect so that it looks like sunlight comes from a certain place.
To demonstrate what I need, I upload 2 images below that I captured from the Google Map application created by Apple. You can imagine that a Pin annotation is an image that has a Pin shape, so the shadow also has a “contact shape”, but it's not just “offset” with CGSize, you can see that the top of the shadow is shifted to the right by about 35 degrees and slightly squeezed the height.
When we press and hold and lock, the shadow is also animated from the pin, so I believe that such a shadow can be made programmable.
, , http://nachbaur.com/blog/fun-shadow-effects-using-custom-calayer-shadowpaths , , .
- - , , . .
( , , , Photoshop, .)

