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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:00:33+00:00 2026-06-13T10:00:33+00:00

I am creating custom cell contain UILabel , UIImageView ,using constant tag for UILabel

  • 0

I am creating custom cell contain UILabel , UIImageView ,using constant tag for UILabel , UIImageView using dynamic tag, the table have 11 cells, the first 7 cells loading correctly, the 8, 9, 10, 11 cell image view change when I am changing the 1, 2, 3, 4, cell respectively in the table, also the tags are same in the cells, I am using the images to check box in table,UITapGestureRecognizer used to change imageview in the table,

I am using this code…..

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier =@"Cell";
    UITableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:CellIdentifier];


    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
        cell.selectionStyle=UITableViewCellSelectionStyleGray;
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(5, 12, 20, 20)];
        imageview.tag=n;
        [cell.contentView addSubview:imageview]; 
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabimage:)];
        imageview.userInteractionEnabled=YES;
        [imageview addGestureRecognizer:tap];
        imageview.image=[UIImage imageNamed:@"img1.jpeg"];

        UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(30, 2, 260,26)];
        titleLabel.tag=222;
        titleLabel.backgroundColor=[UIColor clearColor];
        [cell.contentView addSubview:titleLabel];

        UILabel *dateLabel=[[UILabel alloc]initWithFrame:CGRectMake(30, 31, 260, 13)];
        dateLabel.tag=333;
        dateLabel.font=[UIFont systemFontOfSize:10];
        dateLabel.backgroundColor=[UIColor clearColor];
         [cell.contentView addSubview:dateLabel];
    }
    UIImageView *imageview1=(UIImageView*)[cell.contentView viewWithTag:n];
    if([array containsObject:[NSNumber numberWithInt:imageview1.tag]]) {
       imageview1.image=[UIImage imageNamed:@"img2.jpeg"];  
    } else {
       imageview1.image=[UIImage imageNamed:@"img1.jpeg"];   
    }

    UILabel *titlelable=(UILabel*)[cell.contentView viewWithTag:222];
    titlelable.text=[task objectAtIndex:indexPath.section];
    NSLog(@"%i",indexPath.section);

    UILabel *dateLabel=(UILabel*)[cell.contentView viewWithTag:333];
    dateLabel.text=[date objectAtIndex:indexPath.section];
    n++;
    return  cell;
}

- (void)tabimage:(id)sender {
    UIImageView *iv=(UIImageView *)[sender view];
    int i=iv.tag;
    NSLog(@"------------%i",i);
   if (iv.image==[UIImage imageNamed:@"img1.jpeg"]) {
       iv.image= [UIImage imageNamed:@"img2.jpeg"];
       [array addObject:[NSNumber numberWithInt:i]];
   } else {
      iv.image= [UIImage imageNamed:@"img1.jpeg"];  
      [array removeObject:[NSNumber numberWithInt:i]];
    }
  }
  • 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-13T10:00:35+00:00Added an answer on June 13, 2026 at 10:00 am

    i am getting solution for my app,

    to using dynamic cell identifier in my code

    NSString *CellIdentifier =[NSString stringWithFormat:@"%i-%i", indexPath.section,indexPath.row];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table cell for which I set its contentView to a custom
I have a custom cell that has an UIImageView in it that I do
I have a custom UITableViewCell that consists of a UIImageView and a UILabel. The
I am loading a custom cell into a table view, and notice that my
I have a UITableView with custom cells, those cells contain some textFields. Here when
While creating a custom iOS table view cell, I created a new .xib file,
I am creating custom cell in my iphone aap and I am also adding
I'm creating a custom cell setup. My issue is when I add a subview
I'm creating custom UserControl in ASP.NET and I'm using System.ComponentModel.Attributes to decorate properties with
I have mastered creating custom data types and adding fields with CCK. Then I

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.