如何在 C# 中删除 TableView 中的行时从右到左对单元格进行动画处理



我有一个数据列表,它们显示在TableView中。

我有一个属性作为"数据加载">

  • 当这是false我需要显示一种单元格
  • 如果是true我需要显示不同的。

因此,在删除表格视图中的现有单元格时,我需要对其进行动画处理(从右到左(。

如何实现这一点?
任何输入都会有所帮助。提前感谢!

我已经试过了

ListView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Left);

但是这里的动画太快了!!

我写了一个示例函数,你可以试一试:

public void deleteRowsAtIndexPathswithRowAnimation(NSIndexPath indexPath) {

UITableViewCell cell = tableV.CellAt(indexPath);
cell.Frame = new CoreGraphics.CGRect(0, cell.Frame.Y, cell.Frame.Size.Width, cell.Frame.Size.Height);
UIView.BeginAnimations("deleteAnimation");
UIView.SetAnimationDuration(1);
cell.Frame = new CoreGraphics.CGRect(View.Bounds.Size.Width, cell.Frame.Y, cell.Frame.Size.Width, cell.Frame.Size.Height);
UIView.CommitAnimations();
tableItems.RemoveObject(indexPath.Row);
tableV.ReloadData();
}

最新更新