JoniVR / VerticalCardSwiper

A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
MIT License
1.4k stars 101 forks source link

Strange behaviour of CardCell layout #29

Closed Lavmint closed 5 years ago

Lavmint commented 5 years ago

New Issue Checklist

Issue Description

Steps to reproduce:

  1. Create UIViewController and add UILabel inside of it, stretch label to edges with constraints
  2. Add VC's view as subview to CardView, stretch VC's view to edges of CardView with constraints
  3. Run app and try to scroll, it seems that glitch depends on size of text

output

Environment

JoniVR commented 5 years ago

Hi @Lavmint

This is (most probably) due to the firstItemTransform property of the custom flowlayout.

Because the card resizes (transforms) once it gets pushed to the background, the contents of the card need to be resized too (this happens at every bounds change, see the shouldInvalidateLayout function inside VerticalCardSwiperFlowLayout.swift).

So everything is actually working as intended (including the constraints).

Possible solutions:

Hope this helps. 😄

I'll be closing this for now as it's intended behaviour. Feel free to reopen if you have feedback, questions or remarks. 🙂

Best regards Joni