简体   繁体   中英

UICollectionView Custom Layout With A Single Cell In View

I'm trying to make an application that only has one row of cells in a UICollectionView, however I'm using the FlowLayout and that stacks cells as seen below.

在此处输入图片说明

I want to make it something like this. Where the user can swipe left or right to get to the next cell. Is this possible?

在此处输入图片说明

You have to do 3 things : Set the FlowLayout to scroll horizontally, enable paging, and set the size of your cell to take the whole space. All this can be done in a nib file in the settings of the CollectionView : (CollectionView - ScrollDirection, ScrollView - paging enabled, and CollectionViewSize - Cell Size/Height).


在此处输入图片说明

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM