Continue to the next article on moving lines: moving the line we use
-(void) TableView: (UITableView *) TableView Moverowatindexpath: (Nsindexpath *) Sourceindexpath Toindexpath: ( Nsindexpath *) Destinationindexpath
(UITableView *) TableView used to specify the table view, (Nsindexpath *) Sourceindexpath used to specify the index path to move the row (Nsindexpath *) Destinationindexpath the index path used to specify the row to move to the target location
Core code:
<pre name= "code" class= "OBJC" >//Move line-(void) TableView: (UITableView *) TableView Moverowatindexpath: (Nsindexpath *) Sourceindexpath Toindexpath: (Nsindexpath *) destinationindexpath{ Nsinteger fromrow = [Sourceindexpath row]; Nsinteger Torow = [Destinationindexpath row]; ID object = [a objectatindex:fromrow]; [a removeobjectatindex:fromrow]; [a insertobject:object atindex:torow];}
iOS Development Learning # Table View # (3) Move line