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
daiyuechuan
V2EX  ›  iDev

iOS - 如何让页面顶部添加一组 tab 呢?

  •  
  •   daiyuechuan ·
    CrazyNeil · 2015-05-05 20:12:53 +08:00 · 3096 次点击
    这是一个创建于 3272 天前的主题,其中的信息可能已经有所发展或是发生改变。

    使用UITabBarController可以添加一组tab,但是是在页面底部。
    例如我的第一个tab是新闻,然后我想在页面的顶部再添加一组tab,例如:财经,军事,IT,以方便用户在新闻的页面中通过点击顶部的tab切换到不同的分类。

    请问这种结构应该用什么组件或者方式来做呢?我看到过有用navigationbar来做的,不过太复杂

    7 条回复    2015-05-07 16:41:39 +08:00
    zucknet
        1
    zucknet  
       2015-05-05 20:17:47 +08:00
    Github Code4app上一大把。。
    charlie21
        2
    charlie21  
       2015-05-06 02:38:46 +08:00   ❤️ 1
    should go to /go/idev @Kai
    xujialiang
        3
    xujialiang  
       2015-05-06 08:27:02 +08:00
    一直自己写。。。。。。几个tab 就一个view。。。。横线滑动动画用pop库事先
    cheng4741
        4
    cheng4741  
       2015-05-06 13:21:57 +08:00
    自己写一个,其实你这情况也可以用UISegmentedControl
    nellace
        5
    nellace  
       2015-05-07 11:32:49 +08:00
    @xujialiang pop库是Facebook的那个吗?我看没有能解决这个的啊?
    xujialiang
        6
    xujialiang  
       2015-05-07 13:52:57 +08:00
    @nellace
    我说的是 自己在uiview上放几个button。。。。。。 自己实现一个tabar
    #import <UIKit/UIKit.h>

    @protocol TabbarDelegate;

    @interface Tabbar : UIView

    @property (nonatomic,assign) NSInteger currentIndex;

    @property (nonatomic,assign) id<TabbarDelegate> delegate;

    -(void)doClickItemMenu:(id)param sender:(id)sender;
    @end

    @protocol TabbarDelegate <NSObject>

    - (void)tabBar:(Tabbar *)tabBar didClickAtIndex:(NSInteger)item param:(id)param;

    @end
    nellace
        7
    nellace  
       2015-05-07 16:41:39 +08:00
    @xujialiang 我以为是facebook pop库呢。。。。。。我说我咋没看到呢
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2862 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 13:49 · PVG 21:49 · LAX 06:49 · JFK 09:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.