Please change next part of code:
public TableSource (List<Item> Items, UIViewController viewController)
{
_Items= Items;
parentController = viewController;
}
Pergunta
I have a tableview. I would like when i click on a row to capture row info on a list and pass them on DetailScreen UIViewController. I have create iPhone view controllers with xamarin studio and for the layout i am using Xcode. I am trying the follow code but i am taking error"System.NullReferenceException: Object reference not set to an instance of an object " I have tried this solution without success: How to navigate to ViewController in Xamarin iOS on RowSelected event
My code:
UIViewController parentController;
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
var dtscreen = new DetailScreen (mylist);
parentController.NavigationController.PushViewController(dtscreen,true);// Error System.NullReferenceException
tableView.DeselectRow (indexPath, true);
}
Solução
Please change next part of code:
public TableSource (List<Item> Items, UIViewController viewController)
{
_Items= Items;
parentController = viewController;
}