This project is the "beginning iOS8 programming with Swift" project learning note = = "All Notes directory
--------------------------------------------------------------------------------------------------------------- ---
1. Implement the following method to automatically turn on the swipe delete feature:
Override func TableView (Tableview:uitableview, Commiteditingstyle Editingstyle:uitableviewcelleditingstyle, Forrowatindexpath indexpath:nsindexpath) {}
2. Customize right-sliding menu items
OverrideFunc TableView (Tableview:uitableview, Editactionsforrowatindexpath indexpath:nsindexpath), [Anyobject]? { //Share ItemsLet shareaction = Uitableviewrowaction (style:. Default, Title:"Share") {(action, indexpath), Voidinch //choose a goal to shareLet Sharemenu = Uialertcontroller (title:nil, message:"Share using", Preferredstyle:. Actionsheet) Let Twitteraction= Uialertaction (title:"Twitter", Style:. Default, Handler:nil) let Facebookaction= Uialertaction (title:"Facebook", Style:. Default, Handler:nil) let Emailaction= Uialertaction (title:"Emain", Style:. Default, Handler:nil) let Cancelaction= Uialertaction (title:"Cancel", Style:. Cancel, Handler:nil) sharemenu.addaction (twitteraction) sharemenu.addaction (facebookaction) s Haremenu.addaction (emailaction) sharemenu.addaction (cancelaction) Self.presentviewcontroller (shareMen U, Animated:true, Completion:nil)} //Delete Item (Implementation of this method requires that you write the delete item yourself)Let deleteaction = Uitableviewrowaction (style:. Default, Title:"Delete") {(action, indexpath), Voidinch //Delete from the data source// ...self.tableView.deleteRowsAtIndexPaths ([Indexpath], withrowanimation:. Fade)}//Set Background colorShareaction.backgroundcolor =Uicolor.orangecolor () Deleteaction.backgroundcolor=Uicolor.bluecolor ()return[ShareAction, Deleteaction]}
:
Fourth Chapter Sliding Delete