Question

im new to stackoverflow and objective c, so forgive me in advance :)

i have a UIcollectionView that displays a virtual folder list when clicking on "Add Folder" a cell is added to the collection. The cell has a UITextField inside that i make FirstResponder, which pops up the virtual keyboard and the user can edit the name of the folder. works good on every folder im adding.

the problem is when the user is tapping a folder.

I do reloadData to the CollectionView (cuz i now wanna show the tapped folder's content) and after that every folder that i add wont pop up the virtual keyboard, and the UITextField wont become first responder ?

anyone has an idea why that is ?

another interesting thing is that when i tap on the collection (an empty area that has no cells) and after that tries to create a new folder, the keyboard returns..

Was it helpful?

Solution

My problem was that my UITextField was on the cell itself, and the fact that UICollectionView is using reusable cells. So every time i got me a different cell (an exisiting one when it was available and a new one when it wasent) and couldnt locate where to send my becomeFirstRisponder. I solved it by giving every cell a uniq identifier at creation time and looking for the right identifier when sending the becomeFirstRisponder command.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top