I have requirement like below image.
But, i'm confused about how to achieve this? Can i achieved it by using 3 UIImageViews
or UIViews
. If both then, which one is better? Finally, i have to combine three images & make one from that three images. I should be able to get touch of image too. I have no idea about this. Thanks.
Every
UIView
has a backingCALayer
(accessible byaview.layer
).Every
CALayer
has amask
property, which is anotherCALayer
. A mask allows to define a see-through shape for the layer, like a stencil.So you need three
UIImageView
s, each of them has a different.layer.mask
, each of these masks is a differentCAShapeLayer
whose.path
are triangularCGPath
s.Repeat three times.
You can use
UIBezierPath
andCAShapeLayer
to achieve thisStep1: Copy following code
TrImageView.swift
Step2: Set the custom class
Step3: Use it