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

  • Home
  • SEARCH
  • 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 8928765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:31:18+00:00 2026-06-15T08:31:18+00:00

I have a tableview with a custom tableviewCell. In this tableview cell I have

  • 0

I have a tableview with a custom tableviewCell. In this tableview cell I have a button for deleting a row.

First of all I create this tableview by the following code.

   UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 70, 320, 150) style:UITableViewStylePlain];
    tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.backgroundColor = [UIColor blackColor];
    tableView.separatorStyle = normal;
    [tableView reloadData];

I have an appointments array that I use as my datasource. In my cellForRowAtIndex I use the following code to attach my button to an action.

 cell.btnDelete.tag = indexPath.row;
    [cell.btnDelete addTarget:self action:@selector(deleteAppointment:) forControlEvents:UIControlEventTouchUpInside];

And then I have my action itself.

-(void)deleteAppointment:(id) sender{
        NSLog(@"till here");
    UIButton *button = (UIButton *)sender;
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:button.tag inSection:0];
    NSLog(@"indexpathc: %d",indexPath.row);

    [tableView beginUpdates];
    [tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject:indexPath]
                     withRowAnimation: UITableViewRowAnimationFade];
    [_exceptions removeObjectAtIndex:indexPath.row];
    [tableView endUpdates];
}

It gives back the right index path in my log but it don’t delete the row inside my tableview. Can anybody help me?

Kind regards

  • 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-15T08:31:19+00:00Added an answer on June 15, 2026 at 8:31 am

    You also need to update the method numberOfRowsInSection. For example if you are keeping your elements in an array, delete one element from it and return updated array in numberOfRowsInSection.

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

Sidebar

Related Questions

I build a TableView with custom TableViewCell, the first custom cell have a tool
i have a tableView with a custom cell, my first cell is different with
I have a custom tableview cell. But when I want to call this cell
In my app I have a tableView with custom cell, this is .h of
I have a custom tableview cell which has a button. I need to pass
I have a facebook like button in a custom tableview cell. In the class
I have a custom tableview cell created programmatically that consists of: a background view
I have a tableview with custom UITableViewCells, each row in the table has a
I have 5 cells in a tableview that are all custom. Meaning, I've created
I have made major changes and setup a custom class for the TableView Cell.

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.