2012-02-29 80 views
2

我目前使用Monotouch.Dialog中概述的高级编辑tableview,它允许用户删除以及编辑表格元素的标签。有没有一种方法可以丰富桌面视图以实现类似于屏幕截图的操作,即更改排序?monodouch DialogViewController元素的更改顺序

rearrange order of table elements

回答

4

您需要这两种方法添加到您的DialogViewController.Source

 public override bool CanMoveRow (UITableView tableView, NSIndexPath indexPath) 
     { 
      return true; 
     } 

     public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath) 
     { 
      tableView.MoveRow(sourceIndexPath,destinationIndexPath); 
     } 
+0

谢谢你的作品。我需要做什么才能在订单中进行更改?目前,我选择完成后会回到最初的顺序。 MoveRow()中的 – kos 2012-02-29 15:10:57

+0

需要手动对数据源进行必要的更改,以便在重绘表格时正确排序。 – Jason 2012-02-29 16:26:17

+1

MonoTouch.Dialog的示例应用程序(在DemoEditingAdvanced.cs中)已更新以显示此功能,请参阅:https://github.com/migueldeicaza/MonoTouch.Dialog/commit/62d5008c50ba3f5479c10a553451a6202af8d382#Sample – poupou 2012-03-06 16:06:51