简体   繁体   中英

update content of custom UITableViewCell not working

I am creating a custom UITableViewCell as in http://www.e-string.com/content/custom-uitableviewcells-interface-builder

all is working fine with no problem. The loading of data is correct, which proved that the linking in IB is correct too.

I am trying to update the content, a UILabel, on the custom cell from another function in the class which take a reference to the table containing the cell and the indexPath. However the label is not being reset the value desired.

My problem is similar to this: Cannot update Custom UITableViewCell but it does not have a solution :(

I tried calling [myTable reloadData] and [cell reloadInputViews] but neither worked for me.

Not sure how to do this can any one suggest something?

Cheers AF

UPDATE:

I found what was going wrong! In my current code i am receiving the updates that i need to show in the UILabel from another thread, which calls the updating function on the client object directly (i pass reference to it to the second thread), and that is wrong!! I have used instead [myClientObject performSelectorOnMainThread:myUpdatingFunction waitUntilDone:NO] and it all worded as charm...

Thanks for the help and sorry for not posting the code...

try:

[cell setNeedsDisplay];

or:

[cell.custumLabel setNeedsDisplay];

that forcing the cell/label to draw himself again

good luck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM