I am trying to build a collection view on a page which has 2 sections. I want the section 1 cells to be coloured yellow and the section 2 cells to be coloured blue.
I have managed to get the collectionview cells to show up - however the cells don't appear to have any padding between them - and where the background colour ends. How do I add more coloured padding around the cells to make them look tidier? ( ideally with interface builder)
Screenshot:
Edit: After adding Edge Insets to my custom cell - it gets me closer to what I am after but seems to truncate the text - and remove my rounded corners:
Code:
override func drawText(in rect: CGRect) {
let insets = UIEdgeInsets.init(top: 5, left: 5, bottom: 5, right: 5)
super.drawText(in: UIEdgeInsetsInsetRect(rect, insets))
}
Is there a way to get UICollectionViewFlowLayoutAutomaticSize to take into account the extra 10 width and keep the rounded corners ( when using insets)?