As shown in the picture, there are cells with values on the label and cells without displaying anything, but in this state, 3 seems to be in the cell where nothing is displayed (indexpath.row==2).
I'd like to shift the display of 3 by one to make it look like 1, 2, empty cells, 3, 4, is there any way?
The information displayed in the cell should be set in func collectionView(_collectionView:UICollectionView, cellForItemAtindexPath:IndexPath)->UICollectionViewCell
.
All you have to do is write a program that sets what you want to see for the indexPath
given there.
In this case, if you only want the third cell, or indexPath.item==2
, to be a blank cell,
if indexPath.item<2{
cell.label.text="\"(indexPath.item+1)"
} else if indexPath.item==2{
cell.label.text="
} else{
cell.label.text="\"(indexPath.item)"
}
All you have to do is write a branching process as shown in .
(Assume that the cell has a UILabel type property called label.Please adjust to your program.)
577 Who developed the "avformat-59.dll" that comes with FFmpeg?
585 PHP ssh2_scp_send fails to send files as intended
579 Understanding How to Configure Google API Key
925 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
624 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.