Forum Xamarin.iOS

WillEndDragging Problem

JooFerreira.2190JooFerreira.2190 PTUniversity ✭✭

Hi,

I have an application that lists various recipes. But since I am communicating with a service that returns me only 20 entries at one time, the idea is that each time the user reaches the end of the list it carries more. For this I have the following code

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
listaReceitas = new UITableView (View.Bounds);
listaReceitas.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
tableSource = new TableSource ();
tableSource.OnRowSelected += (object sender, TableSource.RowSelectedEventArgs e) => {
if (receitaScreen == null) {
receitaScreen = new ReceitaScreen ();
}
var receita = (Receita)tableSource.Data [e.indexPath.Row];
receitaScreen.Receita = receita;
NavigationController.PushViewController (receitaScreen, true);
};
listaReceitas.Source = tableSource;

        listaReceitas.WillEndDragging += (object sender, WillEndDraggingEventArgs e) => 
        {

            var cells = ((UITableView)sender).VisibleCells.Length;

            var last = ((UITableView)sender).VisibleCells[cells-1].TextLabel.Text;
            var lastSource = tableSource.Data[tableSource.Data.Count -1].Nome;

            if(last == lastSource)
            {
                MakeButton();
                GetMoreReceitas(false);
                DemissButton();
            }
        };
        Add (listaReceitas);

        // Perform any additional setup after loading the view, typically from a nib.
    }

The problem is that when I use the WillEndDragging, the OnRowSelected of TableSource dont work. And it is impossible to go to the detail screen

Posts

Sign In or Register to comment.