UICollectionView align logic missing in horizontal paging scrollview

前端 未结 16 1184
天命终不由人
天命终不由人 2020-12-07 06:49

I\'ve got a UICollectionView, which works ok, until I start scrolling. Here some pics first: \"enter

16条回答
  •  隐瞒了意图╮
    2020-12-07 07:45

    I think I understand the problem. I'll try and make you understand it too.

    If you look closely, then you will see that this issue happens only gradually and not just on the first page swipe.

    enter image description here

    If I understand correctly, in your app, currently, every UICollectionView item are those rounded boxes which we see, and you have some offset/margin between all of them which is constant. This is what is causing the issue.

    Instead, what you should do, is make a UICollectionView item which is 1/3rd of the width of the whole view, and then add that rounded image view inside it. To refer to the image, the green colour should be your UICollectionViewItem and not the black one.

提交回复
热议问题