ios - Hiding a specific cell hides random cells -
when create uicollectionviewcells
, tried in cellforrowatindexpath
(if indexpath.row == 3){ cell.hidden = yes; }
i have 6 cells. they're randomly set hidden
when refresh collectionview. not 1 cell hidden (even though hardcoded 3
make sure @ least 1 cell).
any clue?
its because cell reused.
keep in mind, when use if
in cellforrowatindexpath
, must implement else
part.
if (indexpath.row == 3){ cell.hidden = yes; } else { cell.hidden = no; }
or
cell.hidden = indexpath.row == 3;
Comments
Post a Comment