Hi
I have the following tableviewdelegate:
private class TableViewDelegate : UITableViewDelegate
{
private DaysViewController _dvc;
private List<DateTime> ConferenceDates;
public TableViewDelegate (DaysViewController controller, List<DateTime> dates)
{
_dvc = controller;
ConferenceDates = dates;
}
/// <summary>
/// If there are subsections in the hierarchy, navigate to those
/// ASSUMES there are _never_ Categories hanging off the root in the hierarchy
/// </summary>
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
string date = ConferenceDates[indexPath.Row].ToShortDateString ();
Console.WriteLine ("DaysViewController:TableViewDelegate.RowSelected: Label=" + date);
/*SessionsViewController sessionsView = new SessionsViewController(date);
sessionsView.Title = date;
_dvc.NavigationController.PushViewController(sessionsView,true);*/
EventsViewController eventsView = new EventsViewController (date);
eventsView.Title = date;
try {
_dvc.NavigationController.PushViewController
(eventsView, true);
} catch (Exception ex) {
Log.Error(ex);
}
}
}
which gets added like so:
tableView = new UITableView {
Delegate = new TableViewDelegate (this, ConferenceDates),
DataSource = new TableViewDataSource (this, ConferenceDates),
AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth,
BackgroundColor = UIColor.Clear,
TableHeaderView = navBar,
Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height)
};
It all works well for the UITableView - the data gets loaded etc but whenever I click on a cell to load the child data - _dvc.NavigationController is null
does anyone know where this gets set? or perhaps, if it's set by the framework - how it might get nulled?
cheers - let me know if i need to post more of the code.
w://