Reputation: 397
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?
Upvotes: 1
Views: 1640
Reputation: 11700
If you want to update the UIViews
, you need to put them in main thread:
dispatch_async(dispatch_get_main_queue(),{
cell.customLabel.text = "text goes here"
})
Upvotes: 2