public override void ViewDidLoad()
{
base.ViewDidLoad();
var scheduleButtoncontroller = (IntroController)Storyboard.InstantiateViewController("IntroController");
var PriceButtonController = (PriceViewController)Storyboard.InstantiateViewController("PriceViewController");
ScheduleButton.TouchUpInside += (o, e) =>
{
if (NavController.TopViewController as IntroController == null)
this.NavController.PushViewController(scheduleButtoncontroller, true);
SidebarController.CloseMenu();
};
PriceButton.TouchUpInside += (o, e) =>
{
if (NavController.TopViewController as PriceViewController == null)
this.NavController.PushViewController(PriceButtonController, true);
SidebarController.CloseMenu();
};
我用它来按下幻灯片菜单上的按钮来推动视图控制器。当我导航到同一个视图两次时(例如我按下价格按钮并转到该屏幕,然后按下计划按钮导航到另一个屏幕,然后我再次按下价格按钮,它得到一个错误),我得到例外
抛出Objective-C异常。名称:NSInvalidArgumentException原因:不支持多次推送同一个视图控制器实例
如何解决此问题?