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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:57:56+00:00 2026-05-18T10:57:56+00:00

I have an issue in creating a CheckMarkAccessoryView in the UITableView .When i select

  • 0

I have an issue in creating a CheckMarkAccessoryView in the UITableView.When i select a row in the table i can get a checked mark for that row,but randomly some other rows in the table also gets the check mark.I want only that cell to get the check mark.How can i do this?I am coding for an exclusive list.The following is the code which i have used.

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{   
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{   
    if(tableView==tableView1)
    {
        return […arraycount1…. ];
    }
    else 
    {   
        return […arraycount2…. ];
    }
}

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

    static NSString *CellIdentifier = @"Cell";

    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    { 
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }
    else 
    {
        UIView* subview;
        while ((subview = [[[cell contentView] subviews] lastObject]) != nil)
            [subview removeFromSuperview];
    }

    if(tableView == tableView1)
    {
        cell.textLabel.text=[array1 objectAtIndex:indexPath.row];
    }
    else                    //Tableview2
    {
        cell.textLabel.text=[array2 objectAtIndex:indexPath.row];       
    }

    cell.textLabel.font=[UIFont fontWithName:@"Georgia" size:20];
    cell.textLabel.textAlignment=UITextAlignmentLeft;
    [cell setSelectedBackgroundView:border];    
    return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{   

    UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:lastindex]; 
    if (oldCell.accessoryType == UITableViewCellAccessoryCheckmark); 
    {   
        oldCell.accessoryType = UITableViewCellAccessoryNone;   
    }

    UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];     

    if (newCell.accessoryType == UITableViewCellAccessoryNone) 
    {   
        newCell.accessoryType = UITableViewCellAccessoryCheckmark;  
    }   
}

Kindly correct me where i am going wrong.
Thanks in advance for all the experts.

  • 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-05-18T10:57:56+00:00Added an answer on May 18, 2026 at 10:57 am

    The two if statement cancel each other, just add else like the following :

    UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:lastindex]; 
    if (oldCell.accessoryType == UITableViewCellAccessoryCheckmark) 
    {   
        oldCell.accessoryType = UITableViewCellAccessoryNone;   
    }
    else
    {
        UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];     
    
        if (newCell.accessoryType == UITableViewCellAccessoryNone) 
        {   
            newCell.accessoryType = UITableViewCellAccessoryCheckmark;  
        }  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue with creating a transaction. I get an error back that
We have an issue with the way we are creating a Mutex . The
I have an issue that is driving me a bit nuts: Using a UserProfileManager
I do not currently have this issue , but you never know, and thought
I have a issue about creating databases in SQL 2005. I want to be
I seem to have an issue when creating copies of a template and tying
I have run into an issue when creating a object type in Oracle 10g
I have run into an issue while creating a data service and using Autofac
I have this issue with Core Data. I am creating a core-data-based application, for
I have the same issue as Creating an additional related model with Devise (which

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.