美文网首页
绘制SegmentViewController的方法

绘制SegmentViewController的方法

作者: 瞅你咋地 | 来源:发表于2015-12-11 09:13 被阅读0次

    首先在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

    相关文章

      网友评论

          本文标题:绘制SegmentViewController的方法

          本文链接:https://www.haomeiwen.com/subject/cqeyhttx.html