[英]Perform a segue in another tab
I have the following setup: 我有以下设置:
This is a simple graphical representation: 这是一个简单的图形表示:
My problem is the following: Given that there are two paths to the shopping cart, it's possible to have two instances of it and that's very confusing to the user. 我的问题如下:考虑到购物车有两条路径,有可能有两个实例,这会使用户感到困惑。 How do I make sure the cart always loads in tab 1? 如何确定购物车始终在选项卡1中加载?
Create yours custom segue: subclass UIStoryboardSegue
and in -perofrm
implement opening first tab and pushing SecondViewController. 创建您的自定义segue: UIStoryboardSegue
子类并在-perofrm
实现打开第一个选项卡并按下SecondViewController。
- (void) perform
{
SecondTabViewController* stvc = self.sourceViewController;
UITabBarController* tbc = stvc.navigationController.tabBarController;
UINavigationViewController* nvc = tbc.viewControllers.firstObject;
tbc.selectedViewController = nvc;
[nvc pushViewController:self.destinationViewController animated:YES];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.