swift - Adding a certain amount of values from an Array to a Collection View -
i have array of uiimages add collection view 40 cells. want use integer choose amount of uiimages taken array , add default uiimage remaining cells.
(if integer 7 want take 7 uiimages array , use default uiimage @ remaining 33 cells)
this how add image image cells.
cell.imageview?.image = imagearray[indexpath.row]
in cellforitem(at:)
:
if indexpath.item >= 7 { cell.imageview?.image = defaultimage } else { cell.imageview?.image = imagearray[indexpath.item] }
you can replace 7
property of uicollectionview
subclass , check that.
Comments
Post a Comment