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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:50:40+00:00 2026-06-10T10:50:40+00:00

I have a UITableview that I’m displaying some tasks and each row has a

  • 0

I have a UITableview that I’m displaying some tasks and each row has a checkbox to mark tasks complete or not.

I’m looking to toggle the checkmark when the user taps on the checkbox, and switch to a detailed view when the user taps on the row. The latter is easy, just by using

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

However, I wanted to separate the selection areas, toggling only the checkbox when the accessoryview is selected, and going into detailed view only when the rest of the cell is selected. If I add a UIbutton inside the accessoryview, the user would be selecting the row AND the UIButton when they only wanted to hit the checkbox, right?

Also, what if the user was just scrolling through the tableview by dragging along the accessoryview? Wouldn’t this trigger an action on the UIButton on TouchUp?

Anyone have any ideas on how to do this? Thanks for your time!

  • 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-10T10:50:41+00:00Added an answer on June 10, 2026 at 10:50 am

    How about managing accessory taps inside this delegate method:

    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
    

    EDIT:

    You can do something like this for custom accessoryView that responds to accessoryButtonTappedForRowWithIndexPath: method.

    In cellForRowAtIndexPath: Method –

    BOOL checked = [[item objectForKey:@"checked"] boolValue];
    UIImage *image = (checked) ? [UIImage   imageNamed:@"checked.png"] : [UIImage imageNamed:@"unchecked.png"];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
    button.frame = frame;
    [button setBackgroundImage:image forState:UIControlStateNormal];
    
    [button addTarget:self action:@selector(checkButtonTapped:event:)  forControlEvents:UIControlEventTouchUpInside];
    button.backgroundColor = [UIColor clearColor];
    cell.accessoryView = button;
    
    - (void)checkButtonTapped:(id)sender event:(id)event
    {
       NSSet *touches = [event allTouches];
       UITouch *touch = [touches anyObject];
       CGPoint currentTouchPosition = [touch locationInView:self.tableView];
       NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
       if (indexPath != nil)
      {
         [self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
      }
    }
    
    - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
    {
      NSMutableDictionary *item = [dataArray objectAtIndex:indexPath.row];
      BOOL checked = [[item objectForKey:@"checked"] boolValue];
      [item setObject:[NSNumber numberWithBool:!checked] forKey:@"checked"];
    
      UITableViewCell *cell = [item objectForKey:@"cell"];
      UIButton *button = (UIButton *)cell.accessoryView;
    
      UIImage *newImage = (checked) ? [UIImage imageNamed:@"unchecked.png"] : [UIImage imageNamed:@"checked.png"];
      [button setBackgroundImage:newImage forState:UIControlStateNormal];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help. I have a UITableView that has cells that hold the
I have UITableView that have 7 section .. each section have 1 row ..
I have a UITableView that has 1 blank row at the top of it,
I have a UITableView that has a disclosure button on every row. When the
I have a UITableView that displays images associated with contacts in each row. In
I have a UITableView that has about 20 cells. Each has a UILabel within,
I have a UITableView that has some cells and I add a UITextField to
I have a UITableView that displays single large images in each cell. The names
I have a uitableview that loads fairly large images in each cell and the
I have a UITableView that displays some data that is read in at runtime

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.