Вы также можете использовать приведенный ниже код. Надеюсь, что это может помочь.
Возьмите 2 изменяемых массива, скажем - массив1 и массив 2.
В viewDidLoad выделите массивы и сохраните значенияоба массива.
(void)viewDidLoad
{
array1=[NsMutableArray alloc]init];
[array1 addObject:@"string1"];
[array1 addObject:@"string2"];
[array1 addObject:@"string3"];
array2=[NsMutableArray alloc]init];
[array2 addObject:@"int1"];
[array2 addObject:@"int2"];
[array2 addObject:@"int3"];
}
Затем продолжите с кодом ниже в cellForRowAtIndexPath.
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] ;
}
cell.textLabel.text =[array1 objectAtIndex:indexPath.row];
cell.detailTextLabel.text =[array2 objectAtIndex:IndexPath.row];
return cell;
}