我是iOS新手,请帮助我。我从服务器收到一些消息,其密钥为“messageId”。我在tableview中显示这些消息。现在我必须区分,如果在该tableview中有第一次打开的新消息,则必须更改单元格中该消息的颜色。更改表格视图单元格颜色如果消息是新的
cell.notificationMessageDate.text = [[self.notifications objectAtIndex:indexPath.row] valueForKey:@"msgCreatedDate"];
cell.notificationMessageText.text = [self stringByStrippingHTML:[[self.notifications objectAtIndex:indexPath.row] valueForKey:@"message"]];
NSString *str = [[self.notifications objectAtIndex:indexPath.row] valueForKey:@"messageId"];
self.isAlreadyExist = false;
if (str) {
cell.backgroundColor = [UIColor whiteColor];
} else {
}
显示您尝试的代码。 –
我必须检查,如果messageId已经存在于该表中,那么它应该是白色的,如果它打开拳头时间,那么它应该是蓝色。 – AADi
cell.notificationMessageDate.text = [[self.notifications objectAtIndex:indexPath.row] valueForKey:@“msgCreatedDate”]; cell.notificationMessageText.text = [self stringByStrippingHTML:[[self.notifications objectAtIndex:indexPath.row] valueForKey:@“message”]]; NSString * str = [[self.notifications objectAtIndex:indexPath.row] valueForKey:@“messageId”]; self.isAlreadyExist = false; if(str){cell_backgroundColor = [UIColor whiteColor]; } else {} – AADi