Draw a shadow which is hidden under the semi-transparent view?

好久不见. 提交于 2019-12-04 15:15:01

You probably want to set the rasterized property of the layer to YES, which will composite the shadow before other effects such as opacity are applied to the view.

Note however that this has a big performance impact. There's a handy table of different shadow implementations and their performance implications here: http://www.omnigroup.com/blog/entry/ipad_drop_shadow_performance_test/

Karoy Lorentey

Use CGContextEOClip to set up a clipping path that excludes your shape, then set up your shadow and draw the shape with full opacity. There is some example code in this answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!