この(初心者の)問題にしばらく立ち往生しているので、今助けを求めています:)
私の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;
}
ただし、次のように行番号を複製して、同点のスコアを考慮しようとしています。
1. David 100
2. Arron 92
3. Cindy 90
4T. Gina 85
4T. Harry 85
6. Daniel 82
...
つまり、ジーナとハリーは、同じスコアであっても、4と5ではなく4位で同点になります。
これは私がcellForRowtIndexPath
メソッドでできることですか?topPersons
NSMutableArray
または、人の名前の一部として行番号/ランクを含めるように更新する別の方法でこれを行う必要がありますか?
どんな助けでもいただければ幸いです-ありがとう!