I need to work with the elements of the collection. But the problem is that after I return my cell, I can take all the data from it, but I cannot change anything, to the extent that the method

newCell.textField.becomeFirstResponder() 

not called. If I correctly understood Swift, then we no longer appeal to the memory, but create a new Yakut with which we can work, but the old one remains. Nothing works in this.

How can I limit the work with an existing cell?

PS The code that I use below is nothing unusual ...

 func textFieldShouldReturn(textField: UITextField) -> Bool { let rootViewPoint: CGPoint = (textField.superview?.convertPoint(textField.center, toCoordinateSpace: newOrderTableView!))! if let tmpIndexPath = newOrderTableView.indexPathForItemAtPoint(rootViewPoint) { if (tmpIndexPath.row < allLabelName.count - 1) { let indexPath = NSIndexPath(forRow: tmpIndexPath.row + 1, inSection: 0) let newCell = collectionView(newOrderTableView, cellForItemAtIndexPath: indexPath) as! EPNewOrderCollectionViewCell print(newCell.textField.placeholder) newCell.backgroundColor = UIColor.redColor() return true } } } 

    1 answer 1

    Here for those who did not know ...

    Instead of method

     let newCell = collectionView(newOrderTableView, cellForItemAtIndexPath: indexPath) as! EPNewOrderCollectionViewCell 

    Need to use

     let newCell = newOrderTableView.cellForItemAtIndexPath(indexPath) as! EPNewOrderCollectionViewCell