如何在 C# 中删除 TableView 中的行时从右到左单元格设置动画
How to animate from right to left cells while deleting the rows in TableView in C#
我有一个数据列表,它们显示在 TableView
。
我有一个 属性 作为“数据加载”
- 当这是
false
我需要显示一种单元格
- 如果是
true
我需要显示一个不同的。
因此,在删除 TableView 中的现有 Cell 时,我需要对其进行动画处理(从右到左)。
如何实现?
任何输入都会有所帮助。提前致谢!
我已经试过了
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();
}
我有一个数据列表,它们显示在 TableView
。
我有一个 属性 作为“数据加载”
- 当这是
false
我需要显示一种单元格 - 如果是
true
我需要显示一个不同的。
因此,在删除 TableView 中的现有 Cell 时,我需要对其进行动画处理(从右到左)。
如何实现?
任何输入都会有所帮助。提前致谢!
我已经试过了
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();
}