csuzhangxc
V2EX  ›  iOS

iOS 中跨分支导航跳转问题

  •  
  •   csuzhangxc · May 21, 2015 · 2980 views
    This topic created in 4020 days ago, the information mentioned may be changed or developed.

    iOS中的storyboard中使用segue进行跳转,原始添加的segue像下面这样。
    -> A -> B
    /
    R
    \
    -> C

    如果需要从 C 跳转到 A,而且这样跳转后从 A pop 时是直接返回到 R,而不是 C,通常怎样设计?

    是 C 先 pop 到 R,并进行标记,在类似 viewWillAppear 的地方判断后再立刻 push A?

    或者是先从 C push 到 A,再从 stack 中删除 C?

    5 replies    2015-05-22 10:38:25 +08:00
    xingso
        1
    xingso  
       May 21, 2015
    难道不是 C push 个A ,然后直接popToViewController : R 么?
    csuzhangxc
        2
    csuzhangxc  
    OP
       May 22, 2015
    @xingso 怎么处理 backBarButtonItem 会比较好?
    lionyue
        3
    lionyue  
       May 22, 2015   ❤️ 1
    setviewcontrollers就可以了
    csuzhangxc
        4
    csuzhangxc  
    OP
       May 22, 2015
    @lionyue 我在 A 中 setViewControllers 为 [R, A],但点 A 的backBarButonItem 返回到 R 时,R 的 backBarButtonItem 还会继续显示一个 R.title(本来期望此时不再显示任何 backBarButtonItem)
    csuzhangxc
        5
    csuzhangxc  
    OP
       May 22, 2015
    @lionyue 感谢,我在 C 中时,不 push,而是直接 setViewControllers OK
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2838 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 322ms · UTC 14:55 · PVG 22:55 · LAX 07:55 · JFK 10:55
    ♥ Do have faith in what you're doing.