2011-03-02 73 views
0

我在DataSource类下面的代码在UITableView上触发移动?

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

public override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath) 
{ 
     ... code for swapping the location of stuff in a list 
    } 

如何触发“移动”?如果我刷我的UITableView我得到我的删除按钮,但我如何得到'移动'?我是否需要放置一个按钮,然后将表格放入BeginEditting模式?任何示例代码来做到这一点?

+0

[管理行的重新排序](http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/ManageReorderRow/ManageReorderRow.html%23//apple_ref/doc/uid/ TP40007451-CH11-SW1)章节中详细解释了这一点。虽然Objective-C中有示例代码,但它不应该很难转换。 – Anna 2011-03-02 03:33:20

回答

1

为了让表格能够执行移动操作,需要将表格设置为“编辑”模式(tableView.Editing = true;)。

相关问题