UIView category to easily use a bezier path as mask.
If your project doesn't use ARC: you must add the -fobjc-arc
compiler flag to UIView+HLMaskedView.m
in Target Settings > Build Phases > Compile Sources.
- Simply drag the
./HLMaskedView
folder into your project and importUIView+HLMaskedView.h
where needed.
- (void)maskWithBezierPath:(UIBezierPath *)bezierPath
resizingMode:(HLMaskResizing)resizingMode;
This parameter defines how your mask must be resized before masking your instance of UIView. They follow Apple official convention:
HLMaskResizingNone
Describes how the bezier path must be resized
HLMaskResizingScaleToFill
Fit the initial view area, the mask ratio is not preserved
HLMaskResizingAspectFit
Fit as much as possible the initial view area, preserving mask ratio
HLMaskedView was developed by Hervé Heurtault de Lammerville. If you have any feature suggestion or bug report, please help out by creating an issue on GitHub. If you're using HLMaskedView in your project, please let me know.