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.
精彩评论