我正在从Table View导航到View Controller,当我点击行时,我得到例外System.NullReferenceException has been thrown Object reference not set to an instance of an object
这是代码:
UITableViewController _contact;
public Contactlist(UITableViewController contact)
{
_contact=contact;
}
public override void Row Selected (UITableView tableView, NSIndexPath indexPath)
{
// Error System.NullReferenceException
_contact.NavigationController.PushViewController(new incomingscreen(),true);
}
请帮助
答案 0 :(得分:0)
除非ViewController包含在NavigationController中,否则ViewController的NavigationController属性将为null。
window.RootViewController = new UINavigationController(new MyTableViewController());