コード例 #1
0
ファイル: SwissTableView.cs プロジェクト: GrimmRanger/FGUtils
        private void Swiped(UITableViewCell cell)
        {
            if (cell != null)
            {
                float threshold = (cell.Frame.Width * _deleteThreshold);
                if (cell.Frame.X > threshold || cell.Frame.X < -threshold)
                {
                    float x = cell.Frame.X < 0 ? -cell.Frame.Width : cell.Frame.Width;

                    UIView.Animate (0.25, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                        cell.Frame = new RectangleF (new PointF(x, cell.Frame.Y) , cell.Frame.Size);
                        cell.Alpha = .5f;
                    }, () => {
                        cell.RemoveFromSuperview();
                        BeginUpdates();
                        NSIndexPath path = IndexPathForRowAtPoint (LastPoint);
                        DeleteRow(path);
                        EndUpdates();
                    });
                }
                else
                {
                    UIView.Animate (0.25, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                        cell.Frame = new RectangleF (new PointF(0, cell.Frame.Y), cell.Frame.Size);
                        cell.Alpha = 1f;
                    }, () => {
                    });
                }
            }
        }