I have an array of NSStrings , one UILabel and a UICollectionView .
My question is:
I want the array count to determine the number of UICollectionViewCell .
Each UICollectionViewCell contains a button. After clicking this button, I want this button to UICollectionViewCell data in the array corresponding to the UICollectionViewCell number that will be displayed on the label.
For example, if the user clicks on the 13 UICollectionViewCell button, then the 13th NSString in the array becomes the text UILabel .
What I've done:
I created my own subclass of UICollectionViewCell for the nib file, which I use for all UICollectionViewCell s, and connected the button to the .h file as IBAction . I also imported MainViewController.h , which contains an array property that stores NSString s.
When I edit the code in the UICollectionViewCell action, I cannot access the property of the array. Button works - I put NSLog in the IBAction method, which works.
I searched for dozens of other answers to SO, but no one answered my specific question. I can update this with my code samples if necessary.
tagabek
source share