Shane Shane - 7 months ago 28
Swift Question

swift - set UILabel without reload of custom UITableViewCell

Is it possible to set a value for a UILabel in a custom UITableViewCell without reloading the cell?

I've tried many permutations of:

let indexPath = NSIndexPath(forRow: 0, inSection: 0)
let cell = tableView.cellForRowAtIndexPath(indexPath) as! CustomTableViewCell1
cell.customLabel.text = "text goes here"


.. and I don't understand why this won't work. I've got a UITextField in the UITableViewCell, and when I set the textField value I'd like only the label to update, but not reload the entire cell. Any suggestions?

Answer
 cell.customLabel.setNeedsDisplay()