开发者

Masking UIImageView on iPhone/iPad

开发者 https://www.devze.com 2023-03-27 19:58 出处:网络
How to mask a 开发者_C百科UIImageView to reveal certain parts of it?UIImageView is a subclass of UIView, which means you can access its layer property. CALayer objects, which you can add as sublayers

How to mask a 开发者_C百科UIImageView to reveal certain parts of it?


UIImageView is a subclass of UIView, which means you can access its layer property. CALayer objects, which you can add as sublayers or set them to the layer property of your UIImageView object, then have a mask property which should be very useful for what you want to achieve. The layer object to be used as a mask can also be animated with core animation, which is a plus if you want to add dynamic moving masks, for example, to your image.

You have to import the QuartzCore framework to use CALayer — just a reminder.

0

精彩评论

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

关注公众号