开发者

Triggering a move on an UITableView?

开发者 https://www.devze.com 2023-02-14 10:03 出处:网络
I have the following code in my DataSource class public override bool CanMoveRow (UITableView tableView, NSIndexPath indexPath)

I have the following code in my DataSource class

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

pub开发者_如何学Clic override void MoveRow (UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath)
{
       ... code for swapping the location of stuff in a list
    }

How do I trigger a 'move'? If I swipe my UITableView I get my delete button, but how do I get a 'move'? Do I need to put a button and then put the table into a BeginEditting mode first? Any sample code for doing that?


In order to get the table to allow you to perform the move action, you need to set the table into "editing" mode ( tableView.Editing = true; ).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号