开发者

Mask a UIImageView with another UIImageView

开发者 https://www.devze.com 2023-03-19 01:49 出处:网络
Is there any way you can mask a UIImageView with the alpha of another UIImageView? I know there is a way to mask images using Quartz2D in a custom U开发者_如何学GoIView, but is there any way you can d

Is there any way you can mask a UIImageView with the alpha of another UIImageView? I know there is a way to mask images using Quartz2D in a custom U开发者_如何学GoIView, but is there any way you can do this in a more direct way accessing just both UIImageViews separately?


ViewX contains 2 sub-views, view1 and view2. View1 has alpha=.5 and view2 has alpha=1.0. If view1 is in front of view2, you will see a semi-transparent view1 on top of a full view2.

If, on the other hand, view2 is a subview of view1, with the alpha values as above, view2 will "inherit" the .5 alpha from it's superview.

0

精彩评论

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