I have a table view that displays list of clients (logo of a client + name etc) and at the same time I created 4 buttons that link to specific information about each client (such as overview and such).
Everything works properly when clicking on these buttons and I am taken to the proper corresponding viewui
info.
Now the problem is when I sort everything alphabetically. Everything gets sorted properly (company names and such) except the buttons still link to the previous indexPath.row
order...
So when I click on client one in the alpha list I see the information of the first client which is correct,., now if I click on the first client under the letter B... I see the information of first client in list A... so the indexpath of the buttons is not sorted at all....
Here is my code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath *offsetPath = [self modelRowIndexForIndexPath:indexPath];
//NSLog(@"Requested: %@ -- Off: %@",indexPath,offsetPath);
RMCustomClientCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ClientCell"];
RMClients *client;
if(!self.alphaMode){
client = [self.clients objectAtIndex:indexPath.row];
} else {
NSString *key = [self.alphaKeys objectAtIndex:offsetPath.section];
NSArray *specificClients = [self.sortedClients objectForKey:key];
client = [specificClients objectAtIndex:offsetPath.row];
}
cell.extraDetailsButton.tag = indexPath.row;
cell.overviewDetailsButton.tag = indexPath.row;
cell.listDetailsButton.tag = indexPath.row;
cell.eventsDetailsButton.tag = indexPath.row;
cell.nameLabel.text = client.name;
return cell;
}
Now how do I correct this cell.extraDetailsButton.tag = indexPath.row;
(the indexPath.row) should be replaced by something else, right?