分享一个仿网易新闻客户端iPhone版的标签式导航ViewController

     该Controller是一个容器,用于容纳其他的controller。效果与网易新闻客户端的标签式导航基本一样:

   (1)点击上面的标签,可以切换到对应的controller,标签下面的红色提示条的长度会动态变化。

   (2)在下面的内容区里左滑或者右滑可以切换对应的controller,标签会同时变化。     

 

效果如下图所示:

     

使用方法:

    NSArray *titleArray = [NSArray arrayWithObjects:@"轻松一刻",@"头条",@"北京",@"房产",@"移动互联",@"财经",@"科技",@"游戏",@"历史",@"军事",@"大满贯", nil];
    
    NSMutableArray *controllerArray = [[NSMutableArray alloc]init];
    for (NSString* title in titleArray)
    {
        ViewController *vc = [[ViewController alloc]init];
        vc.labelTitle = [title stringByAppendingString:@" View Controller"];
        [controllerArray addObject:vc];
    }
    
    GuGuSegmentNaviViewController *controller = [[ GuGuSegmentNaviViewController alloc]initWithItems:titleArray andControllers:controllerArray];

 

代码下载:https://github.com/gugupluto/GuGuSegmentNaviViewController

 

 

posted @ 2014-02-21 20:56  酷酷的冥王星  阅读(1546)  评论(4编辑  收藏  举报