已经在这个(初学者)问题上停留了一段时间,所以现在寻求帮助:)
在我的UITableView
中,我展示了一个表格,其中的行包含:1) 行 #、2) 一个人的姓名和 3) 他们的分数。
它看起来像这样:
1. David 100
2. Arron 92
3. Cindy 90
4. Gina 85
5. Harry 85
6. Daniel 82
...
我在我的 UITableView 中使用此代码生成此代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"PersonCell"];
cell.textLabel.text = [NSString stringWithFormat:@"%d. %@", indexPath.row+1,[topPersons objectAtIndex:indexPath.row]];
cell.detailTextLabel.text = [[topPersonsScore objectAtIndex:indexPath.row] stringValue];
return cell;
}
但是,我试图通过复制行#s来解释并列分数,例如:
1. David 100
2. Arron 92
3. Cindy 90
4T. Gina 85
4T. Harry 85
6. Daniel 82
...
所以吉娜和哈利现在并列第四而不是第四和第五,即使他们的分数相同。
这是我可以在cellForRowtIndexPath
方法中做的事情吗?或者我应该在另一种方法中执行此操作,更新我topPersons
NSMutableArray
的行#/排名作为人名的一部分?
任何帮助将不胜感激 - 谢谢!