I am trying to build a simple chat client. What I have is a UITableView with the user names and a small status image on the left in each cell. I am getting the usernames and current status (offline/online) from a server. My problem is how do I refresh my status logo? The code is pretty involving but here's the part where i am loading the images.Any help please.开发者_JS百科.
if (indexPath.section == 1)
{
if([[userDetails objectAtIndex:2] isEqualToString:@"Logged Off"])
{
cell.imageView.image = [UIImage imageNamed:@"offline.png"];
} else {
cell.imageView.image = [UIImage imageNamed:@"online.png"];
}
}
P.S. it seems that there is some confusion regarding the question..I am getting the status logo to diplay just fine at the initial login..my problem is how do i refresh them as they are changed on the server
try using [cell setNeedsLayout];
精彩评论