The Delete button on the custom UITableViewCell

Source: Internet
Author: User

1. You can delete a row in TableView by using the Uitableviewdelegate method

Swipe to delete

-(void) TableView: (uitableview *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (nsindexpath *) indexpath

{

Nsuinteger row = [Indexpath row];

[bookInforemoveobjectatindex: Row];//bookinfo is the array displayed in the current table

[TableView deleterowsatindexpaths: [nsarrayarraywithobject: indexpath]withrowanimation: Uitableviewrowanimationleft];

}


At this point the Delete button is delete, if you want to display as "delete" in Chinese, you need to implement Uitableviewdelegate-(NSString *) TableView: (UITableView *) TableView Titlefordeleteconfirmationbuttonforrowatindexpath: (Nsindexpath *) Indexpath Square

[plain] view plaincopy
  1. -  (nsstring *) TableView: (uitableview *) tableview  Titlefordeleteconfirmationbuttonforrowatindexpath: (nsindexpath *) indexpath{    
  2. }    

Or, in the simplest way, change the localization native development region in plist to China

2. This just lets the default delete button to display the Chinese delete button only, if want to change this delete button to other picture form, how to do? [CPP] view Plaincopy
  1. -(uitableviewcell *) TableView: (uitableview *) tableview  Cellforrowatindexpath: (nsindexpath *) indexpath    
  2. Static;
  3. If< Span style= "border-width:initial; border-color:initial; Color:black; Cell = [[[uitableviewcell alloc] initwithframe:cgrectzero reuseidentifier: Rootviewcontrollercell]autorelease]; Border-style:none; padding:0px; margin:0px; " >
  4. ForIfClassReturnvoidForIfbreak}

Delete button on custom UITableViewCell

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.