0

I have a UICollectionReusableView that I’m using for section headers. It looks like this:

enter image description here

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):

  1. Use 2 UIViews or CALayers to make the left and right sides of the divider.
  2. Use a mask. I think this could be a single UIImageView using resizableImage(withCapInsets:).
  3. Use the draw(_:) method.
JWK
  • 3,345
  • 2
  • 19
  • 27
  • Are you facing render issues? What kind of border did you use when you got it? – MCMatan Feb 05 '19 at 19:08
  • I'm using option 1 with `UIView`s at the moment. Intuitively, adding extra `UIView`s for every section header doesn't seem like the best approach. So, I'd like to know which of the options is likely to perform best and why (or possibly a better way if there is one). – JWK Feb 06 '19 at 04:21
  • If view is reusable, it seems fine to me – MCMatan Feb 06 '19 at 17:40

0 Answers0