我使用此代码请检查
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier forIndexPath:indexPath];
NSString *text,*text1; if (_segment.selectedSegmentIndex==0)
{
if ([tableView isEqual:ResultsTableView])
{
text = self.results[indexPath.row];
} else
{
keydata = [sortedKeys objectAtIndex:indexPath.section];
arrayKey = [[dict objectForKey:keydata] allKeys];
NSString *yourString = [arrayKey objectAtIndex:indexPath.row];
text=yourString;
}
cell.textLabel.text = text; else
{
if ([tableView isEqual:ResultsTableView])
{
text1 = self.results[indexPath.row];
} else
{
keydata1 = [sortedKeys1 objectAtIndex:indexPath.section];
arrayKey1 = [[dict1 objectForKey:keydata1] allKeys];
NSString *yourString = [arrayKey1 objectAtIndex:indexPath.row];
text1=yourString;
}
cell.textLabel.text = text1;
return cell;
}