mercredi 24 juin 2015

Find the UITableViewCell of an element in my Model

I would like to scroll in my tableView to a specific item. I know which item this is in my model. However, I can't be certain in which cell/indexPath it will be displayed for various reasons (the model may be filtered and sorted before displayed; the tableView may be grouped; etc.)

I was thinking of checking for the element in the cellForRowAtIndexPath tableView function and if found setting a global variable of type UITableViewCell or NSIndexPath. I'm reluctant, though, to do this - It is somewhat ugly solution due to handling global variables (not very functional / "spaghetti code".)

What is the best practice of finding the cell (or indexPath) of a specific element in my model?

See more ..

Aucun commentaire:

Enregistrer un commentaire