In the comment you provided the code for your numberOfRowsInSection
method as follows:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0)
return [[testM data_webs] count];
else
return [[testS data_webs] count];
}
However, your willDisplayCell
ignores indexPath.section
when you access current_data
. When the cell from a section that has more rows is displayed, your code will crash.
You should change your code to something like this:
NSArray *data_webs;
// This part mimics your "numberOfRowsInSection'
if (indexPath.section == 0) {
data_webs = [testM data_webs];
} else {
data_webs = [testS data_webs];
}
data_web *current_data ;
current_data = [data_webs objectAtIndex:indexPath.row];
I do not know what's structured_question
in your code was, and why you were using it, but the above should eliminate the crash in the objectAtIndex:
method.