我想更改集合视图中每个第3个单元格的宽度。目前,我正在设置元素的宽度和高度:
sys:resume
如何选择集合视图中的每个第3个元素并使该元素全宽?在css中,它是元素:nth-child(3n),所以类似于那个。
答案 0 :(得分:5)
看起来很好用modulus
运算符! (或者,真的,%
)
let offset = 0 //modify to change where it starts
return (indexPath.row % 3 + offset) == 0 ? fullSize : normalSize