(edit added on Navigationbar)
Edit---Complete
-(void) bianji{
if (Self.tableview.isediting==no) {
[Self.tableview setediting:yes animated:yes];
UIImage *imagetmp=[uiimage imagenamed:@ "Baoxun_01.png"];
[Self.btn setimage:imagetmp Forstate:uicontrolstatenormal];
} else {
[Self.tableview setediting:no animated:yes];
UIImage *imagetmp=[uiimage imagenamed:@ "Bianji_01.png"];
[Self.btn setimage:imagetmp Forstate:uicontrolstatenormal];
}
[Self.tableview Reloaddata];
}
-(void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) Indexpath {
if (Editingstyle = = Uitableviewcelleditingstyledelete) {
Remove rows from an array
[MyData RemoveObjectAtIndex:indexPath.row];
Table View Remove rows
[Self.tableview Deleterowsatindexpaths:[nsarray Arraywithobject:indexpath] Withrowanimation: Uitableviewrowanimationfade];
Delete the local file if you do not have the following code removed
Nsarray *paths = Nssearchpathfordirectoriesindomains (Nsdocumentdirectory,nsuserdomainmask,yes);
NSString *path = [Paths objectatindex:0];
NSString *filename = [path stringbyappendingpathcomponent:@ "Shoucang.plist"];
Nsmutablearray *array = [[[Nsmutablearray alloc] initwithcontentsoffile:filename]autorelease];
[Array RemoveObjectAtIndex:indexPath.row];
[Array writetofile:filename atomically:yes];
}
}
Edit Delete line method for Iosuitableview