Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I have a collection view whose data is to be organized in rows and columns. The data is to be loaded programmatically. Unfortunately, the collection view doesn't seem to be built for data organized in this manner. (My thanks goes to the people who, in my previous thread on iterating through all of an object's keys, mentioned the possibility of using an enumerator.)
 

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
After giving this problem some thought, I decided to build a function that uses the visibleCells property of the collection view. If the count is zero, then the cell being generated is the first cell, so the cell is in the first column. If not, then the app will loop through each visible cell until it reaches a cell that is either at the end of the first row or at the end of the array.
 

DannyBres

macrumors 65816
Oct 30, 2007
1,412
6
UK
could also use the visible cell's bound's origin to work out where on the screen it is?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.