Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Erro ao navegar entre as telas com Xamarin IOS sem storyboard

$
0
0

Estou com problema ao chamar uma segunda ViewController dentro do método RowSelected em uma class que contem a interface UITableViewSource, ao fazer a chama mesmo instanciando a ViewControlller ocorre um erro "Object reference not set to an instance of an object", mas estou batendo a cabeça para resolver este problema, alguém saberia me informar o que está ocorrendo?

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);
}

}
}


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>