TableView Slide Removal

Source: Internet
Author: User

-(BOOL) TableView: (UITableView *) TableView Caneditrowatindexpath: (Nsindexpath *) indexpath{if(Indexpath.section = =0) {        returnNO; }    returnYES;}-(Uitableviewcelleditingstyle) TableView: (UITableView *) TableView Editingstyleforrowatindexpath: (Nsindexpath *) indexpath{returnUitableviewcelleditingstyledelete;}-(NSString *) TableView: (UITableView *) TableView Titlefordeleteconfirmationbuttonforrowatindexpath: (Nsindexpath *) indexpath{return @"Delete";}- (void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) indexpath{if(Editingstyle = =uitableviewcelleditingstyledelete) {Nsinteger Index= (indexpath.section-1); Address*address =[Self.addressarray Objectatindex:index]; //Network Delete address[Svprogresshud Showwithstatus:@"Deleting:"]; Nsdictionary*dict = [Nsdictionary dictionarywithobjectsandkeys:address. Addressid,@"Addressid", nil]; [Self.afservicehelper Getdefaultjsonwithsubmethod:@"Addressinfo_addressid_delete"Parameters:dict Cachepolicy:nsurlrequestuseprotocolcachepolicy success:^(ID json) {[Svprogresshud dismiss]; Nsdictionary*resultdict =JSON; if([[Resultdict objectforkey:m_code] integervalue] = =0) {[Self.addressarray removeobjectatindex:index]; Nsindexset*indexset =[Nsindexset indexSetWithIndex:indexPath.section];            [TableView Deletesections:indexset Withrowanimation:uitableviewrowanimationleft]; } Else{[Self.tableview maketoast:[resultdict objectforkey:m_msg] Duration:1.0Position@"Center"]; }} failure:^ (Nserror *error, NSString *msg) {            if(Error.code = =nsurlerrornotconnectedtointernet)                {[Svprogresshud dismiss]; [Self.tableview maketoast:@"No network"Duration1.0Position@"Center"]; } Else{[Svprogresshud dismisswitherror:@"Delete Failed"];            }        }]; }}

TableView Slide Removal

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.