V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
csuzhangxc
V2EX  ›  iOS

iOS 中跨分支导航跳转问题

  •  
  •   csuzhangxc · 2015-05-21 22:18:26 +08:00 · 2357 次点击
    这是一个创建于 3256 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2015-05-22 10:38:25 +08:00
    xingso
        1
    xingso  
       2015-05-21 22:49:53 +08:00
    难道不是 C push 个A ,然后直接popToViewController : R 么?
    csuzhangxc
        2
    csuzhangxc  
    OP
       2015-05-22 10:18:26 +08:00
    @xingso 怎么处理 backBarButtonItem 会比较好?
    lionyue
        3
    lionyue  
       2015-05-22 10:30:00 +08:00   ❤️ 1
    setviewcontrollers就可以了
    csuzhangxc
        4
    csuzhangxc  
    OP
       2015-05-22 10:35:54 +08:00
    @lionyue 我在 A 中 setViewControllers 为 [R, A],但点 A 的backBarButonItem 返回到 R 时,R 的 backBarButtonItem 还会继续显示一个 R.title(本来期望此时不再显示任何 backBarButtonItem)
    csuzhangxc
        5
    csuzhangxc  
    OP
       2015-05-22 10:38:25 +08:00
    @lionyue 感谢,我在 C 中时,不 push,而是直接 setViewControllers OK
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1144 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 18:21 · PVG 02:21 · LAX 11:21 · JFK 14:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.