ios - UITableView - Controlling or preventing the delete for a specific row in a section -


I am trying to stop the deletion for each last line in each section of my UITableView control. I wrote code that has been working so far.

Is there a way to prevent the delete button from appearing in a specific line in a specific section when editing the UITWV mode? Table view: (View UITableView *) View Comment tab: (UITableViewCellEditingStyle) ROATI and Appet for editing style:

:

(NSIndexPath *) indexPath {NSInteger section = indexPath.section; NSInteger Line = indexPath.row; // If the table view is asking for a command command ... if (edit type == UITableViewCellEditingStyleDelete) {// stop the removal of the last line length = [[[MyItemStore SharedStore] getItemsForGivenSection: section] count] ; // Prevent the last line from being deleted (line == length) {return; } NSArray * items = [[MyItemStore SharedStore] getItemsForGivenSection: section]; MyItem * item = item [row]; [[MyEstmestore ShareStore] removedEstormation: Item section: section]; // Also delete that line from the table view with the animation [Delete the tableviewRainWindexPath: @ [IndexPath] with Row Animation: UITDViewer Animation Fade]; }}

You can use something like this:

  - (BOOL) Table view: (UITableView *) Table view can edit the audit path: (NSIndexPath *) indexPath {// return line for the last line if (indexPath.row == [tableView numberOfRowsInSection: indexPath.section ] - 1) FALSE return; } // Return TRUE TRUE for all other rows; }  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -