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 8508645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:13:05+00:00 2026-06-11T03:13:05+00:00

I have a uitableview that displays the values of an array. I would like

  • 0

I have a uitableview that displays the values of an array. I would like to know if there is a way to update the subtitle of its table cells, based on how many times each cell was tapped.

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-11T03:13:07+00:00Added an answer on June 11, 2026 at 3:13 am

    First of all, you’ll want to use a NSMutableArray so you can change its contents after instantiation. Here’s a basic over view of what I just tried to achieve your intended results:

    In your interface

    @property (strong, nonatomic) NSMutableArray *tapCountArray;
    

    In your implementation

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        self.tapCountArray = [NSMutableArray new];
        int numberOfRows = 20;
    
        for (int i = 0; i < numberOfRows; i ++) {
            [self.tapCountArray addObject:@(0)];
        }
    }
    

    Then the important part!

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return self.tapCountArray.count;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    
        NSString *text = [self.tapCountArray[indexPath.row] stringValue];
        [cell.textLabel setText:text];
        return cell;
    }
    
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        [self.tapCountArray replaceObjectAtIndex:indexPath.row withObject:@([self.tapCountArray[indexPath.row] intValue] + 1)];
        [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
    }
    

    When each cell is tapped the number in its detailTextLabel will be incremented up by one.

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

Sidebar

Related Questions

I have a table that displays data from a single array and organizes the
I have a UITableView that displays single large images in each cell. The names
I have a UITableView that displays various nsstrings from a custom object called a
I have a UITableView that displays some data that is read in at runtime
In my iOS5 application, I have UITableView that would display cells based on NSString
I have a view containing a UITableView. Above the table I'd like to display
I have a UITableView that displays content programmatically. The cells load fine when first
I have a UITableView that displays the value of a property called name of
I have a UITableView that displays a lot of images in the cells, and
I am currently building a UITableView that reads an array and displays it on

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.