Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有很多 CALayer,每个里面都有一个半透明的绿色矩形。当我将所有这些层添加到视图层时,公共区域会改变颜色,如图所示。
有没有什么简单的方法可以避免这种情况,而不必在每次向视图中添加图层时都寻找交叉点?
我不确定这是否有帮助,但如果你的矩形将是相同的颜色(在这种情况下是相同的绿色),那么:
结果:矩形将是半透明的,但当它们重叠时,不透明度不会增加。