I have a UICollectionReusableView
that I’m using for section headers. It looks like this:
I know of a few ways to add the divider line, but am honestly not sure which would be the most performant given a UICollectionView
with many sections and titles of different lengths. Can anyone point me toward the best option and explain why? Here are the options I’ve thought of (though I'm open to others):
- Use 2
UIView
s orCALayer
s to make the left and right sides of the divider. - Use a mask. I think this could be a single
UIImageView
usingresizableImage(withCapInsets:)
. - Use the
draw(_:)
method.