【发布时间】:2011-08-12 21:03:54
【问题描述】:
我有一个 tableView,自定义单元格由 NSMutableDictionaries 填充,位于 NSMutableArray 内。
现在,我想检查valueForKey@"Location" 中当前正在填充的单元格上方的单元格。因为,如果那个位置是相同的,那么下面的那个单元格应该留下一些标签 blanco。
例如:
[Thing on location: Building A has problem X]
[ and problem Y ]
[Thing on location: Building B has problem X]
(是的,我知道,一张糟糕的“绘图”表格,哈哈)。
无论如何,在cellForRowAtIndexPath 我已经尝试过代码:
if ((indexPath.row - 1) > -1)
{
NSString *eerste = [[NSString alloc] initWithFormat:@"%@", [[lijstErrors objectAtIndex:(indexPath.row - 1)] objectForKey:@"Location"]];
NSString *tweede = [[NSString alloc] initWithFormat:@"%@", [incInRow objectForKey:@"Location"]];
NSLog(@"Comparing %@ met %@", eerste, tweede);
}
问题是,它永远不会被调用。我的猜测是,每次填充单元格时都不会调用cellForRowAtIndexPath?有什么提示吗?
【问题讨论】:
-
你能在 if 语句之前转储
indexPath.row吗?然后滚动,这看起来是正确的,仍然没有人知道......
标签: ios objective-c xcode uitableview cell