Wiersze iOS UITableViewCells zostały przetworzone i nie działają

Chciałbym uzyskać pomoc w ustawianiu tagów dla przycisków w komórkach. To jest pytanie z linkiem do poprzedniego opublikowałem:iOS Używanie NSDictionary do ładowania danych do sekcji i wierszy

Jednak mimo że mogłem teraz przekazywać dane dynamicznie, mój przycisk odnawiania w każdym z wierszy nie mógł uzyskać danych i wykryłby tylko ten sam tytuł książki w każdej sekcji, gdy wybrany jest którykolwiek z wierszy w sekcji.

W oparciu o to, co przeczytałem do tej pory, dlatego, że przycisk jest przetwarzany, nie jest w stanie wykryć, która książka jest właściwie wybierana. Próbowałem ustawić tag:

cell.renewButton.tag = indexPath.row;

Jak wygląda mój kod teraz:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

static NSString *CellIdentifier = @"Cell";
UserCustomCell *cell = (UserCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.bookTitle.frame = CGRectMake(12, 0, 550, 40);

if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"UserCustomCell" owner:self options:nil];
    cell = userCustomCell;
    self.userCustomCell = nil;
    cell.renewButton.tag = indexPath.row;
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    cell.bookTitle.frame = CGRectMake(12, 0, 550, 40);
    cell.renewButton.frame = CGRectMake(600, 14, 68, 24);
}
[cell.renewButton useBlackActionSheetStyle];

// ########## EDIT STARTS HERE dataSource = [[NSMutableDictionary alloc] init]; // Musi to być ivar

for (NSDictionary *rawItem in myArray) {
    NSString *date = [rawItem objectForKey:@"date"]; // Store in the dictionary using the data as the key

    NSMutableArray *section = [dataSource objectForKey:date]; // Grab the section that corresponds to the date

    if (!section) { // If there is no section then create one and add it to the dataSource
        section = [[NSMutableArray alloc] init];
        [dataSource setObject:section forKey:date];
    }

    [section addObject:rawItem]; // add your object
}
self.dataSource = dataSource;
//NSLog(@"Data Source Dictionary: %@", dataSource); 

NSArray *sections =[[dataSource allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSString *sectionTitle = [sections objectAtIndex:indexPath.section];

NSArray *items = [dataSource objectForKey:sectionTitle];

NSDictionary *dict = [items objectAtIndex:indexPath.row];
cell.bookTitle.text = [dict objectForKey:@"name"];
cell.detail.text = [NSString stringWithFormat:@"Due Date: %@ Due Time: %@", 
                    [dict objectForKey:@"date"], [dict objectForKey:@"time"]];


cell.renewButton.tag = indexPath.row;
return cell;   

}

ale to w ogóle nie działa. Byłbym baaardzo wdzięczny za wszelkie sugestie :) Dziękuję !!

P.S: Moja kopia xcode nie jest aktualizowana, tylko do wersji4. Widziałem kilka osób wspominających o przechowywaniu statusu tagów w DataModel, ale jest on dostępny tylko w nowszych wersjach. :)

questionAnswers(2)

yourAnswerToTheQuestion