-1

I have a list of data and they are displayed in a TableView.

I have one property as "Data Loading"

  • when this is false I need to show one kind of cell
  • if it is true I need to show a different one.

So while deleting the existing Cell in the TableView I need to animate it (from right to left).

How to achieve this?
Any input would be helpful. Thanks in advance!

I've already tried this

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

but here the animation is too fast!!

Infinite
  • 3
  • 3
  • If you don't like the default animation, you should write your own animation. Have a look at [this answer](https://stackoverflow.com/a/14182059/10539446) and you will get some idea. – nevermore Jul 03 '20 at 08:43
  • Thanks ! But the answer u suggested works only while inserting the rows and also it is in swift. It would be better understandable if it is in Xamarin as I am new to iOS. @JackHua-MSFT Can someone provide the answer for custom animating of cell while deleting based on bool property? – Infinite Jul 05 '20 at 11:25

1 Answers1

0

I write a sample function and you can have a try:

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();
}
nevermore
  • 15,432
  • 1
  • 12
  • 30