V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Hamniba
V2EX  ›  iDev

有个类似 instagram 那种实现效果的问题

  •  
  •   Hamniba · 2015-01-31 23:21:48 +08:00 · 2342 次点击
    这是一个创建于 3374 天前的主题,其中的信息可能已经有所发展或是发生改变。
    搜索了一天,还是没有找到解决办法。so sad...

    情况是这样的:
    首页是个Tab Bar Controller,有5个Tab,每个tab里面是个navigation view controller,tab 3 里的view有个back button需要定制
    当我在浏览tab 1的时候,点击tab 3,然后点击back button返回tab 1的页面;
    当我在浏览tab 2的时候,点击tab 3,然后点击back button返回tab 2的页面;

    也就是说那个back button总是返回previous screen

    情况有点类似于instagram的拍照那个tab,在拍照页面当你点击取消的时候,返回previous screen

    那么,这个back button该怎么写?怎样确定它previous screen是哪一个?
    在stackoverflow上提了该问题
    http://stackoverflow.com/questions/28252857/how-to-back-to-previous-view-in-tab-bar

    有知道的同学还请赐教,谢谢。
    5 条回复    2015-02-03 11:23:04 +08:00
    Elethom
        1
    Elethom  
       2015-01-31 23:37:36 +08:00   ❤️ 1
    那不是 5 個 tabs,而是 4 個 tabs 和一個 present modal 的 entry。
    cralison
        2
    cralison  
       2015-02-01 03:04:25 +08:00
    可以看看有没有办法记录一下前screen,然后传给它。比如TabBar的delegate什么的:)
    Shane
        3
    Shane  
       2015-02-01 11:00:55 +08:00   ❤️ 1
    这种需求下,tab 3 点击后应该present view,然后back button 来 dismiss view.
    可以在tabbarcontroller delegate里面 实现,切换效果自定义
    - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
    Hamniba
        4
    Hamniba  
    OP
       2015-02-01 13:11:07 +08:00
    @Elethom
    @cralison
    @Shane

    figure it out, thanks!
    cralison
        5
    cralison  
       2015-02-03 11:23:04 +08:00
    @Hamniba

    今天我居然也要实现这个功能:)缘分啊,奇葩的需求处处有啊:)


    @Shane

    谢谢Shane叔啊:)
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3100 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 00:10 · PVG 08:10 · LAX 17:10 · JFK 20:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.