// My data to use
let items: [Any] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ...]
/*
// UICollectionView result I want
<Section [Item1, Item2, Item3]>
<Other Section A>
<Section [Item4, Item5, Item6]>
<Other Section B>
<Section [Item7, Item8, Item9]>
<Other Section A>
<Section [Item10, Item11, Item12]>
<Other Section B>
*/
如果我的數據是象下面一個二維數組,我可以看到結果更容易。
let items: [[Any]] = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] ...]
但我想我應該只使用一維數組。
因爲我的項目會經常增加/刪除。並需要API通信..並需要LoadMore函數..也許這些事情變得複雜,如果使用二維數組。而這個問題與其他部分的立場有關。
它可能只有一維數組?我的想法是正確的?
你如何決定哪些項目適合哪個部分?每節只有三個項目嗎? – overactor
@ oractor是的。 – Byoth