user689751
user689751

Reputation:

Masking UIImageView on iPhone/iPad

How to mask a UIImageView to reveal certain parts of it?

Upvotes: 0

Views: 281

Answers (1)

MiguelB
MiguelB

Reputation: 1913

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.

Upvotes: 3

Related Questions