How can one change the textLabel or the detailTextLabel of a specific UITableViewCell dynamically?
Basically, I am downloading a set of files from the internet whenever the user taps on a cell. Now instead of the progress indicator, I would like to display the name of the file currently being downloaded. I would like to keep updating the detailTextLabel to show the (current) filenames until all the files are downloaded.
Assuming you’re in a method like
tableView:didSelectRowAtIndexPath:(or have another way to get the index path to the cell), you can do something like this:This will find the first UILabel in the cell, and may not work if your cell has more than one label. A more robust way to do it is to set the tag of the label when you create the cell (this can be done in Interface Builder or in code). Then you can find the label like this: