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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:32:46+00:00 2026-06-05T23:32:46+00:00

I am developing and tableView in which in each row I have to display

  • 0

I am developing and tableView in which in each row I have to display the click counter and row number.Each cell must have an initial click counter value of 0 when application is initialized. Then increment the click counter value within a cell whenever a user clicks on the cell.

I have take 26 fixed rows. I have taken tableData.plist file as in the attached image.enter image description here

I am initializing the self.dataArray with the plist .

Now I want to do implementation in the didSelectRowAtIndexPath delegate method,if any row is tapped that row’s click counter should increment.

- (void)viewDidLoad {
    [super viewDidLoad];

    NSString *path = [[NSBundle mainBundle] pathForResource:@"tableData" ofType:@"plist"];
    self.dataArray = [NSMutableArray arrayWithContentsOfFile:path];//array initialized with plist
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.dataArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *kCustomCellID = @"MyCellID";
    UILabel *label1 = [[UILabel alloc] initWithFrame:CGRectMake(160.0f, 2.0f, 30.0f, 20.0f)];//label for rowid
    UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(160.0f, 24.0f, 30.0f, 30.0f)];//label for counter
    label2.textColor = [UIColor grayColor];
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:kCustomCellID];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kCustomCellID] autorelease];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    if([self.dataArray count]>indexPath.row)
    {
        label1.text = [[self.dataArray objectAtIndex:indexPath.row] objectForKey:@"Lable1"];
        label2.text =[[self.dataArray objectAtIndex:indexPath.row] objectForKey:@"Lable2"]; 
    }
    else {
        label1.text = @"";
        label2.text =@"";
    }
    [cell.contentView addSubview:label1];
    [cell.contentView addSubview:label2];
    [label1 release];
    [label2 release];
    return cell;
}


#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   //implementation for row counter incrementer.
}
  • 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-05T23:32:48+00:00Added an answer on June 5, 2026 at 11:32 pm

    Try this.

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
       //take dictionary object from dataArray at selected index
       //take Lable2 value as a string and convert it into integer and increment the integer value
       //now convert this incremented integer value into string
       //now save it new string in Lable2 for the object dictionary and add this dict object into dataArray at selected index
        NSMutableDictionary * tempDict = [self.dataArray objectAtIndex:indexPath.row];
        int tempLableInt = [[tempDict objectForKey:@"Lable2"] intValue];
        tempLableInt = tempLableInt +1;
        [tempDict setObject:[NSString stringWithFormat:@"%d",tempLableInt] forKey:@"Lable2"];
        [self.dataArray replaceObjectAtIndex:indexPath.row withObject:tempDict];
        [tableView reloadData];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an iPhone application which uses a TableView to display XML data. The
I am developing an application in which I have a display a lot of
I am developing a Window-based application in which, I added tabBarController and have table
I'm developing a splitview based application.I have three detailviewcontrollers which will be shown in
I am developing a Tab Bar Application in which My need like I Have
I am developing an iPad application in which I need a table view (
I am currently developing an application which contains a UITableView. The UITableView contains custom
I have a problem with my UITableViewCell's. I am developing an application where certain
I'm developing a demo RSS reader for iPhone. I obviously have a tableview to
i am developing an iphone application in which i want to apply table view

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.