0
  1. How to change spacing between the navigation bar and the first collectionViewCell?

enter image description here

  1. I want to be aligned in the middle. In this case, the only way to calculate the screen size?

enter image description here

Barbora
  • 921
  • 1
  • 6
  • 11
Michael Park
  • 105
  • 1
  • 2
  • 5

1 Answers1

0
  1. If you want to add space at the top of your collection view you can use contentInset. There are probably other ways to meet your requirement but this is the easiest way I can think of.

    collectionView.contentInset = UIEdgeInsets(top: 100, left: 0, bottom: 0, right: 0)

  2. I don't understand what you are trying to do. Can you explain more?

HMHero
  • 2,333
  • 19
  • 11
  • umm.. the three cell height be fixed..(and the three cell height is equal.) In this case ...I want to be a cell sorting. and it has equal spacing(4) and vertical center. – Michael Park Jun 25 '16 at 05:31
  • huh? do you want to add same space to the top of each cell? – HMHero Jun 25 '16 at 05:37
  • umm.. explain more , in the collection view vertical.. (top)|-A-[v1]-A-[v2]-A-[v3]-A-|(bottom) (v1..3 is cell)... i want .. the spacing equal... – Michael Park Jun 25 '16 at 05:41
  • Hope you can provide and show me what you've done so far. Any code you made?? – HMHero Jun 25 '16 at 05:46
  • Thank you! It have resolved... using the function....minimumLineSpacingForSectionAtIndex ... the screen size, cell size.. Linespacing was calculated. – Michael Park Jun 25 '16 at 06:04
  • ( mainscreen.bounds.height - (statusbar height + navigationbar height) - ( 3cell size) ) / 4 .... – Michael Park Jun 25 '16 at 06:15