84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
项目中,有很多途径进入到我的订单中.如:
我的订单
我(顶级页面)->我的订单
首页(顶级页面)->商品详情->支付->支付成功->我的订单.
但是需求是,从我的订单只能返回到我的页面.即:
我
我的订单 -(back)->我
在这种需求下,如何来实现呢?
认证高级PHP讲师
Ce qui suit fournit une idée, qui peut être modifiée en fonction des conditions de votre propre projet
Supposons que votre projet possède l'architecture illustrée dans la figure. Vous pouvez ajouter le code suivant à l'interface de commande.
- (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; UINavigationController *nav = self.tabBarController.viewControllers.lastObject; NSMutableArray *vcs = [NSMutableArray array]; [vcs addObject:nav.viewControllers.firstObject]; [vcs addObject:self]; [nav setViewControllers:vcs animated:NO]; [self.tabBarController setSelectedIndex:self.tabBarController.viewControllers.count-1]; }
Méthode 1 :
//回到根视图 navigationController?.popToRootViewControllerAnimated(animated: Bool)
Méthode 2 :
//回到指定视图 navigationController?.popToViewController(UIViewController, animated: Bool)
Pseudo-navigation modale ou entière
Ce qui suit fournit une idée, qui peut être modifiée en fonction des conditions de votre propre projet
Supposons que votre projet possède l'architecture illustrée dans la figure. Vous pouvez ajouter le code suivant à l'interface de commande.
Méthode 1 :
Méthode 2 :
Pseudo-navigation modale ou entière