Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios SWIFT-PNG和背景图像之间的CALayer_Ios_Swift_Swift3_Calayer - Fatal编程技术网

Ios SWIFT-PNG和背景图像之间的CALayer

Ios SWIFT-PNG和背景图像之间的CALayer,ios,swift,swift3,calayer,Ios,Swift,Swift3,Calayer,我已经看过很多关于如何使用图像和矩形或圆形制作遮罩的stackoverflow帖子或教程,但是可以在具有透明度的png文件和背景图像之间制作遮罩 在photoshop截图中,我使用wolf png图像作为背景的遮罩 在SWIFT中,CALayer或其他公司对此有何建议 非常感谢。从iOS 8开始,UIView有一个属性,您可以将该属性设置为具有alpha通道的任何视图,包括包含图像的UIImageView 这只是CALayer属性的一个包装器,其工作原理类似。将图像设置为遮罩层的内容属性,并将

我已经看过很多关于如何使用图像和矩形或圆形制作遮罩的stackoverflow帖子或教程,但是可以在具有透明度的png文件和背景图像之间制作遮罩

在photoshop截图中,我使用wolf png图像作为背景的遮罩

在SWIFT中,CALayer或其他公司对此有何建议

非常感谢。

从iOS 8开始,UIView有一个属性,您可以将该属性设置为具有alpha通道的任何视图,包括包含图像的UIImageView


这只是CALayer属性的一个包装器,其工作原理类似。将图像设置为遮罩层的内容属性,并将遮罩层设置为背景图像层的遮罩。

Ty获取答案。我尝试了UIView mask属性,该属性工作正常,但是在我无法使用UIGestureRecognitor移动背景以使其具有与photoshop相同的功能之后(如果我想缩放背景…)。