我有问题UISplitviewcontroller
,
当我创建splitviewcontroller
(第一次)显示 barbutton 并且它工作正常时,
在 master 中选择表行后,它的 remove detailview1
& add detailview2
,现在 barbutton 未显示。如果我旋转 iPad barbutton 将显示,
我不知道为什么最初不显示栏按钮。我设置了委托,即使它没有显示栏按钮。
这是我使用的代码:
UINavigationController navMaster = appDel.SplitView.ViewControllers [0] as UINavigationController;
if (indexPath.Row == 0)
{
ViewController1 View1 = new ViewController1 ();
UINavigationController nav1 = new UINavigationController (View1);
appDel.SplitView.WeakDelegate = View1;
appDel.SplitView.ViewControllers = new UIViewController[]{ navMaster, nav1 };
}
else if (indexPath.Row == 1)
{
ViewController2 View2 = new ViewController2 ();
UINavigationController nav2 = new UINavigationController (View2);
appDel.SplitView.WeakDelegate = View2;
appDel.SplitView.ViewControllers = new UIViewController[]{ navMaster, nav2 };
}
detailviewcontroller1
这是在和中设置的委托detailviewcontroller2
。
[Export("splitViewController:willHideViewController:withBarButtonItem:forPopoverController:")]
public void WillHideViewController (UISplitViewController splitController, UIViewController viewController, UIBarButtonItem barButtonItem, UIPopoverController popoverController)
{
barButtonItem.Title = "Inputs";
NavigationItem.SetLeftBarButtonItem (barButtonItem, true);
masterPopoverController = popoverController;
}
[Export("splitViewController:willShowViewController:invalidatingBarButtonItem:")]
public void WillShowViewController (UISplitViewController svc, UIViewController vc, UIBarButtonItem button)
{
NavigationItem.SetLeftBarButtonItem (null, true);
masterPopoverController = null;
}
谁能帮我 ?