开发者

Add shading to clipped UIView

开发者 https://www.devze.com 2023-01-02 16:54 出处:网络
I\'m creating an iphone application. I have this UIView whose content is clipped with a path. I want to add shading and/or shadow to it. What\'s the best way to do this? For 开发者_JS百科shadow, I tri

I'm creating an iphone application. I have this UIView whose content is clipped with a path. I want to add shading and/or shadow to it. What's the best way to do this? For 开发者_JS百科shadow, I tried CGContextSetShadow() but it doesn't seem to have an effect (perhaps it's drawing outside the shown region?) . How about shading? I want it to appear along the path. What's the best way to go about it? Is it to create another narrow clip strip along the original clipping path (if it's possible to have two clip path... ) Or does this need to be done in another CALayer? I am not even sure what that is yet.


You can't add shadows to layers which are clipped or masked. The way I would do this is use two CALayers, one for the clipped content and place this inside another for the shadow which isn't clipped.

0

精彩评论

暂无评论...
验证码 换一张
取 消