lundi 25 avril 2016

UICollectionView with randomized reuseIdentifiers in 1 section

I have a UICollectionView with 16 cells. 1 of the cells (the Game Over cell) must be random. I would like to randomize the Game Over cell in the collection view.

I have it somewhat working by using different sections, but that defeats the purpose of visually blending in with the 16.

I also had it somewhat working by creating an array of strings, one of the strings being "GameOver" - and then I did a shuffle on the array to customize how this cell appears.

That also didn't work, because it did not give me IB control of the game over cell.

How can I use the storyboard by creating 2 prototype cell identifiers, to randomize 1 of the game over cells, and 15 normal cells on a collection view of 16 total cells?




Aucun commentaire:

Enregistrer un commentaire