Joetjah Joetjah - 1 year ago 75
Objective-C Question

TableView cells with double values

I've got a tableView, with custom cells being filled by NSMutableDictionaries, inside an NSMutableArray.

Now, I'd like to check the

for the cell above the one currently being filled. Because, if that location is the same, that cell below should leave some labels blanco.

For example:

[Thing on location: Building A has problem X]
[ and problem Y ]
[Thing on location: Building B has problem X]

(Yes I know, a poor 'drawing' of a table, haha).

Anyway, in
I've tried the code:

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);

The problem is, it never gets called. My guess is,
isn't called for every time a cell is filled in? Any hints on that?

Answer Source

No it's called every time a cell is drawn. Set the delegate of the tableView to your instance which hosts the tableview: in most cases it's self.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download