There is a Collection View , which is filled with pictures from the Internet. When you click on one of these views, the second ViewController opens with an enlarged picture.

In the second controller there is a UITextField . I did save the text from this field. When I enter text, then turn off the keyboard, the text is saved normally. But the problem is that the text that I entered is saved on all text fields.

How to make sure that it is saved only to the field in which I entered the text? Give direction, please.

    1 answer 1

    -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { yourTextField.text = nil; return [collectionView dequeueReusableCellWithReuseIdentifier:reuseId forIndexPath:indexPath]; }