I would like to change the layout of each cell in CollectionView
, but how can I do that?For example, if CollectionView
implements three pages of paging processing, you want to place buttons and images in different layouts for each page.In this case, do I use a custom view?Or should I write in code within cellForItemAtIndexPath
?
Please let me know if anyone knows.I'm sorry, but I appreciate your cooperation.
If you are using Storyboard,
Create several UICollectionViewCell layouts on the Storyboard and
You can name it in Identifier and specify it when cellForItemAtIndexPath is created.
NSString* cellIdentifier=@"Identifier of cell";
UICollectionViewCell*cell= [collectionView requestReusableCellWithReuseIdentifier: cellIdentifier forIndexPath:indexPath];
© 2024 OneMinuteCode. All rights reserved.