【发布时间】:2016-03-18 10:56:58
【问题描述】:
当我根据需要更改 tableview 单元格中的图像的值更新表时,我正在使用 tableview 和 Sqlite,它也可以正常工作,但是当我滚动时,我的图像正在更改下面是我的代码
Sqlite 表更新
[DBObject upDateTable:@"Green" :messageID];
我如何从我的数组中获取值
NSString *messageStatus = [[messageArray1 objectAtIndex:index] ColorStatus];
现在我在 cellForRowAtIndexPath 中检查 colorStatus,如下所示
if ([messageStatus isEqualToString:@"Green"]) {
cell.playButtonImageView.image= [UIImage imageNamed:@"message-Green.png"];
[[ASNGlobalClass shareManager] setIsDelivered:YES];
}else if ([messageStatus isEqualToString:@"Red"]) {
cell.playButtonImageView.image= [UIImage imageNamed:@"message-Red.png"];
}else if ([messageStatus isEqualToString:@"Yellow"]) {
cell.playButtonImageView.image= [UIImage imageNamed:@"message-yellow.png"];
}
我的图像分配完美,但是当我滚动时它正在改变我不知道我错过了哪里请帮助我
【问题讨论】:
-
把 else 条件放在最后,将图片设置为 nil
-
你把
NSString *messageStatus = [[messageArray1 objectAtIndex:index] ColorStatus];放在哪里? -
出于检查目的,我使用上面的行如 if ([messageStatus isEqualToString:@"Green"]) {
-
能否在 cellForRowAtindexPath 中添加单元格代码?
-
@RonakChaniyara 对不起,我没接你?
标签: ios iphone uiimage uitableview