0

In my storyboard I have a UICollectionView, with cells, sections, etc. I set as delegate and datasource a custom class (so, not the classic myCollectionView.delegate = self) but a custom class that cares about the retrieving of datas.

In this UICollectionView I have a label that I need to update with a certain value that I handle in the delegate class. (It's a property of the selected cell).

How can this be done? I read about KVO and Notification, but i'm not sure what I have to do.

More Detail

MatchCollectionViewController In this one: viewDidLoad A gameView that act as a container for the following collectionView CollectionView declaration (once created the collectionView i add it to the gameView) The delegate of the CollectionView is the following class CollectionViewUiGrid

CollectionViewUiGrid In this class i implement all the delegate and dataSource methods for the collectionView initWithFrame (and initWithFrame with my own parameters) in the method cellForItemAtIndexPath i return an istance of a class (UiGameCell) that extends UiCollectionViewCell

In the method didSelectItemAtIndexPath i have this logic. If a cell is selected, assign retrieve his property, called CellDescription). This is the property that i would like to be as my UiLabel value in MatchCollectionViewController.

1 Answers1

0

I found a solution.

As mentioned in Pass object with NSNotificationCenter to other view

Probably one of the simplest way is to use a NsNotificationCenter.

Community
  • 1
  • 1