Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8900219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:03:18+00:00 2026-06-15T01:03:18+00:00

Have been stuck on this (beginner) issue for a while so am now asking

  • 0

Have been stuck on this (beginner) issue for a while so am now asking for help 🙂

In my UITableView, I’m showing a table with rows that contain: 1) Row #, 2) a person’s name, and 3) their score.

It looks something like this:

1. David     100
2. Arron     92
3. Cindy     90
4. Gina      85
5. Harry     85
6. Daniel    82
...

I’m generating this with this code in my 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;
}

However, I’m trying to account for tied scores by duplicating row #s, something like:

1. David     100
2. Arron     92
3. Cindy     90
4T. Gina     85
4T. Harry    85
6. Daniel    82
...

so where Gina and Harry are now tied for 4th instead of being 4 and 5 even though they have the same score.

Is this something I can do in the cellForRowtIndexPath method? Or should I be doing this in another method that updates my topPersons NSMutableArray to include the row # / rank as part of the person’s name?

Any help would be appreciated – thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:03:19+00:00Added an answer on June 15, 2026 at 1:03 am

    I would not abuse the cell view or table view for that type of logic. I’d rather calculate the rank in another method and add the rank to the topPerson’s object.

    cellForRowAtIndexPath is not called in any specific sequence. Nor are any of the cell view’s methods called in any particular sequence. And that makes it difficult to perform calculations like these.

    You could of course determine whether the (indexPath.row-1)th topPersons object has the same value and in that case determine whether the (indexPath.row-2)th topPersons object has the same value too and in that case determine whether the (indexPath.row.2)th topPersons … and so forth. But I do not advise doing so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been stuck on this for a while now and I cannot seem
so i have been stuck with this issue for 3 weeks now and i
I have been stuck with this issue now all morning. I actually saw this
I have been stuck with this for a while now, Actually I have 2
I have been stuck on this for a while. i have tried and I
I have now been stuck at this for some time so I though to
I have been stuck on this for a few days now. I am attempting
I have been stuck at this for a while. I have a smartgwt widget
I have been stuck on this for a while and nothing seems to work.
Hell there, I have been stuck on this for a bit now. I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.