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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:02:29+00:00 2026-05-20T05:02:29+00:00

I am trying to implement deletable UITableViewCells. My UITableView has 3 sections. The 1st

  • 0

I am trying to implement deletable UITableViewCells. My UITableView has 3 sections. The 1st section contains one cell for every element of a List (called items for simplicity). Various elements (UILabels and a UIButton) are added to each cell.

Like most articles on the web, my code implements the delegate methods that are in charge of making cells editable:

public override bool CanEditRow(UITableView tableView, NSIndexPath indexPath) {
  if (indexPath.Section == 0 && items.Count > 0) {
    return true;
  }
  return false;
}

public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath) {
  if (indexPath.Section == 0 && items.Count > 0) {
    return UITableViewCellEditingStyle.Delete;
  }
  return UITableViewCellEditingStyle.None;
}

public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) {
  if (editingStyle == UITableViewCellEditingStyle.Delete) {
    items.RemoveAt(indexPath.Row);
    tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.None);
  }
}

Whether or not a cell is editable/deletable is decided in GetCell():

public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) {
  string cellIdentifier;
  UITableViewCell cell;

  if (indexPath.Section == 0) {
    if (items.Count == 0) {
      // Generate a "No data here..." cell
      ...
     } else {
      cellIdentifier = "ItemCell";

      cell = tableView.DequeueReusableCell(cellIdentifier);
      if (cell == null) {
        // Create a new cell
        ...
      }

      cell.Editing = true; // Make the cell deletable
      cell.ShouldIndentWhileEditing = true;
      cell.ShowingDeleteConfirmation = true;

      // Assign item values to the cell
      ...
    }
  } else if (...) { // Other sections go here
  }
  return cell;
}

Placing Console.Writes and breakpoints all over the place made me believe that the EditingStyleForRow() delegate method is not even invoked. None of it’s Console.Writes showed up, no breakpoint in there was ever reached.

All the other delegates work fine though. Table contents show up as expected, just not editable/deletable.

Any hints on what I am doing wrong? Thanks in advance.

EDIT:

Apple docs say that UITableViewCellEditingStyle.Delete will be set for editable cells if the delegate method is not implemented. But it doesn’t work without the method either.

EDIT 2:

Thanks to Ratinhos hint, EditingStyleForRow() is now invoked and correctly returns UITableViewCellEditingStyle.Delete, but the delete controls still don’t appear.

  • 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-20T05:02:29+00:00Added an answer on May 20, 2026 at 5:02 am

    It works now. I completely removed those:

    cell.Editing = true; // Make the cell deletable
    cell.ShouldIndentWhileEditing = true;
    cell.ShowingDeleteConfirmation = true;
    

    Also, CanEditRow() doesn’t really seem to be required. All that is left is tableView.Editing = true and the implementations of EditingStyleForRow() and CommitEditingStyle().

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

Sidebar

Related Questions

trying to implement a dialog-box style behaviour using a separate div section with all
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
Am trying to implement a generic way for reading sections from a config file.
im trying to implement some behaviors when a mapview element scrolls... by coding a
Trying to implement a function that will return a list of ints the represent
I'm trying to implement a Soft-deletable repository. Usually this can be easily done with
Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however
I am currently trying implement a QThread that contains a socket connection. The socket
All I am currently trying implement something along the lines of dim l_stuff as
Trying to implement a rating system of users and postings. What is the best

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.