2

enter image description here

I am making a booking system in my iPad app that uses sections for days and cells for bookings. New bookings can be added by clicking the button on each day section.

As you can see in the image, I have 24 pixels of space on each side of my cells. These are brought in from a separate xib file into the screen's xib. I also bring the section's supplementary view in this way, however, I can't achieve the same effect. One thing to note is that I have a CollectionViewReusableCell on the parent screen. I'm not sure if this makes a difference.

Things I have tried

I've tried putting a view inside of the header's xib which instead would have the desired width, and have set the superview's background colour to transparent, as advised here. I couldn't get the leading or trailing space to work with auto layout though.

I've also tried setting the section insets of the collection view to 24 pixels on the left and right as detailed here. I've tried this on the designer and from code by setting EdgeInsets on the flow layout. But this still does not work.

What am I doing wrong (or right) here?

Community
  • 1
  • 1
Chucky
  • 1,706
  • 6
  • 27
  • 58

1 Answers1

0

Fixed my issue, using this line of code in ViewDidLoadof the ViewController.

View.CollectionView.ContentInset = new UIEdgeInsets(0, 24, 0, 24);

That sets the section padding for the left and right to 24 pixels.

Chucky
  • 1,706
  • 6
  • 27
  • 58