我有下面这样的表格视图
从不同的可变数组显示名称、出生率和天数(如 300、264)
我已经使用了以下代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
UIView *selectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 7, 320, 50)];
[selectionView setBackgroundColor: [UIColor clearColor]];
UILabel *callTypeLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 0, 150, 21)];
callTypeLabel.text = (NSString *)[_combinedNameArray objectAtIndex:[indexPath row]];
callTypeLabel.backgroundColor = [UIColor clearColor];
callTypeLabel.font = [UIFont boldSystemFontOfSize:15.0];
[selectionView addSubview:callTypeLabel];
UILabel *daystogo = [[UILabel alloc]initWithFrame:CGRectMake(200 , -2, 125, 30)];
daystogo.text = @"days to go";
daystogo.backgroundColor = [UIColor clearColor];
daystogo.font = [UIFont boldSystemFontOfSize:14.0];
[selectionView addSubview:daystogo];
UILabel *days = [[UILabel alloc]initWithFrame:CGRectMake(174 , -2, 125, 30)];
days.text = [NSString stringWithFormat:@"%@",[_daysremaining objectAtIndex:[indexPath row]]];
days.backgroundColor = [UIColor clearColor];
days.font = [UIFont boldSystemFontOfSize:14.0];
[selectionView addSubview:days];
UILabel *birthdate = [[UILabel alloc]initWithFrame:CGRectMake(5 , 22, 150, 21)];
birthdate.text = [NSString stringWithFormat:@"%@",[_combinedBirthdates objectAtIndex: [indexPath row]]];
birthdate.backgroundColor = [UIColor clearColor];
birthdate.font = [UIFont boldSystemFontOfSize:14.0];
[selectionView addSubview:birthdate];
[[cell viewWithTag:0] addSubview:selectionView];
return cell;
}
现在我的问题是我如何重新排序这些单元格,比如最短的天数应该是第一个,然后是第二个比它大,等等,例如它应该是 25、201、256,等等名称和出生率在数据库中我将它们保存在数组中并对其进行处理以在另一个数组中查找剩余天数
请为此提出一些建议