Error when navigating between screens with Xamarin IOS

Asked

Viewed 15 times

2

I’m having trouble calling a second Viewcontroller within the method Rowselected in a class that contains the interface Uitableviewsource, while making the flame even instantiating the Viewcontrolller occurs an error "Object Reference not set to an instance of an Object", but I am banging my head to solve this problem, someone would know me to inform me what is occurring?

using System;
using System.Collections.Generic;
using ClickDeliveryMobile.IOS.Views;
using Foundation;
using UIKit;


namespace ClickDeliveryMobile.IOS.DataSources
{
public class CategoriaTableViewSource: UITableViewSource
{
    private List<string> ListCategorias;

    public CategoriaTableViewSource(List<string> ListCategorias)
    {
        this.ListCategorias = ListCategorias;
    }

    public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
    {
        var cell = new UITableViewCell(UITableViewCellStyle.Default, "");


        cell.TextLabel.Text = ListCategorias[indexPath.Row];
        return cell;
    }

    public override nint RowsInSection(UITableView tableview, nint section)
    {
        return ListCategorias.Count;
    }
    public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
    {
        var selecionaCat = ListCategorias[indexPath.Row];


        CategoriaViewController categoria = new CategoriaViewController();

        categoria.NavigationController.PushViewController(new SobreViewController(), true);

        Console.WriteLine(selecionaCat);
    }

}
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.