문제

I have the following setup:

  1. Tab one: a series of view controller to purchase an item placing it in a shopping cart.
  2. Tab two: a series of view controllers that show what you purchased in the past with a button to reorder. When you click reorder it places the items in the shopping cart

This is a simple graphical representation:

enter image description here

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?

도움이 되었습니까?

해결책

Create yours custom segue: subclass UIStoryboardSegue and in -perofrm implement opening first tab and pushing 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 ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top