【发布时间】:2015-02-25 19:16:58
【问题描述】:
我收到此错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing the same view controller instance more than once is not supported
如何检查堆栈中是否已经存在一个控制器,而不是推送该控制器而是移动到它?
这是我根据选项卡选择推送控制器的一些代码:
func tabSelected(tab: String) {
switch tab{
case "payment":
mainNavigationController.popToViewController(myAccountViewController, animated: true)
break
case "delivery":
mainNavigationController.pushViewController(deliveryViewController, animated: true)
break
case "service":
mainNavigationController.pushViewController(serviceViewController, animated: true)
break
case "profile":
mainNavigationController.pushViewController(profileViewController, animated: true)
break
default:
break
}
}
【问题讨论】:
标签: ios swift uinavigationcontroller uitabbar