0

I really like how the new AppStore look on iOS 11 and I love how you can see if there is another item in the collectionView even if it can't fit on the view. Let me explain it better by posting two pictures:

As you can see you can always see the other item even if is out of the self.view. How could I reproduce this with a UICollectionView on Swift 3?

jscs
  • 62,161
  • 12
  • 145
  • 186
Marcoc
  • 568
  • 6
  • 22
  • 2
    Why not simply make the cell width slight less than the screen width? – rmaddy Aug 26 '17 at 23:30
  • Just as rmaddy said, it's nothing new, the cell total width is slightly less than the width of the screen to fit a small portion of the next cell. You can calculate either getting the UIScreen bounds width or the UICollectionView bounds and divide it by the number of cells you want visible - the extra portion of the third cell. –  Aug 26 '17 at 23:32
  • Thank you! @Sneak and rmaddy but the width and height of the cell should be fixed ( 90 x 90 in my case ) – Marcoc Aug 26 '17 at 23:35
  • 1
    Marcoc you can use fixed size together with cellspacing/insets to make up for the total width, however, with fixed size, you wont get that "perfect" slightly visible cell, instead maybe one of your cell will be 20% visible or 90% visible etc. Not as "clean" as the screenshots. But the point of the slight visibility is to make the user be aware that it is scrollable and more content to show. as long as you provide that point to the user that is the most important.... however, clean design is not bad :) –  Aug 26 '17 at 23:39
  • mmh so @Sneak how should I do with code? Thank you very much in advance – Marcoc Aug 26 '17 at 23:43
  • 1
    @Marcoc there are many threads on how to do it, this one i randomly got for you https://stackoverflow.com/questions/28325277/how-to-set-cell-spacing-and-uicollectionview-uicollectionviewflowlayout-size-r , just play around with the spacing etc and you will get a grip on how it works. If you are not working with items but sections, you can also add section spacing https://developer.apple.com/documentation/uikit/uicollectionviewdelegateflowlayout/1617718-collectionview . –  Aug 26 '17 at 23:45
  • @Sneak still can't find a solution. Played around margin and inset but nothing seems to work – Marcoc Aug 27 '17 at 00:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/152923/discussion-between-marcoc-and-sneak). – Marcoc Aug 27 '17 at 00:12
  • example project by me https://github.com/danya0365/appstore-collectionview-swift – Marosdee Uma May 10 '18 at 04:08

0 Answers0