Search code examples
iosuitableviewfirst-responder

How to cycle through cells in UITableView that have not been visible yet?


I am trying to give first responder status to the next table cell of a dynamically generated table, and am doing that by iterating over the tags. That's working well, except when I come to cells that haven't been visible yet and therefore haven't been assigned a tag in tableView:cellForRowAtIndexPath:.

Any idea on how I can assign them a tag or give them the first responder status in any other way?


Solution

  • Since you know the index path of your target cell, you can call scrollToRowAtIndexPath:atScrollPosition:animated: to bring your cell into the view. Then the UITableViewCell will be created in the usual way - through a delegate.