绘制SegmentViewController的方法

首先在AppDelegate里写入

#pragma mark - Methods
- (void)setupViewControllers {
UIViewController *firstViewController = [[SupermarketViewController alloc] init];
UIViewController *firstNavigationController = [[UINavigationController alloc]
initWithRootViewController:firstViewController];

//实例化三个ViewController

OrderViewController *firstVC = [[OrderViewController alloc] init];
twoViewController *secondVC =[[twoViewController alloc] init];
threeViewController *thirdVC = [[threeViewController alloc] init];
JRSegmentViewController *vc = [[JRSegmentViewController alloc] init];

//显示三个按钮

[vc setTitles:@[@"全部", @"待收货", @"待评价"]];
//设置segmentBg的颜色
vc.segmentBgColor = [UIColor orangeColor];
vc.indicatorViewColor = [UIColor whiteColor];
[vc setViewControllers:@[firstVC, secondVC, thirdVC]];
UIViewController *secondViewController = vc;
UIViewController *secondNavigationController = [[UINavigationController alloc]
initWithRootViewController:secondViewController];
UIViewController *thirdViewController = [[MineViewController alloc] init];
UIViewController *thirdNavigationController = [[UINavigationController alloc]
initWithRootViewController:thirdViewController];
RDVTabBarController *tabBarController = [[RDVTabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController, secondNavigationController,
thirdNavigationController]];
self.viewController = tabBarController;
[self customizeTabBarForController:tabBarController];
}

之后引入一个第三方JRSegmentViewController

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • pragma mark - Methods (void)setupViewControllers { UIView...
    Roger_单阅读 1,054评论 0 0
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,305评论 4 61
  • 功力不够,讲不清楚,直接上博客地址 附上自己的Java实现
    alonwang阅读 459评论 0 1
  • 你站在我的面前 背对着我 于是这个世界 只有你 和没有你的地方 我躲在你的阴影背后 偷偷地望着你 看你的头发 和你...
    海伦伦伦阅读 212评论 0 0
  • 岁月的消磨,梦想的起步,流水般的光阴荏苒,几度艰辛,我无暇自顾。命与行,苦与乐,世俗的冷嘲热讽,我绝不退步。张...
    风无痕花落阅读 366评论 0 0