IOS - 分段控制器SegmentedControl

首先导入#import "CNavTabBarController.h"文件


#import "NewsController.h"
#import "Sca1ViewController.h"
#import "Sca2ViewController.h"
#import "Sca3ViewController.h"
#import "Sca4ViewController.h"

#import "SCNavTabBarController.h"

@interface NewsController (){
    UIImageView *_lineView;
}

@end

@implementation NewsController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置导航栏颜色
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0];
    //设置背景颜色
    self.view.backgroundColor = [UIColor whiteColor];
    
    Sca1ViewController *sc1 = [[Sca1ViewController alloc]init];
    sc1.title = @"第一个";
    
    Sca2ViewController *sc2 = [[Sca2ViewController alloc]init];
    sc2.title = @"第二个";
    
    Sca3ViewController *sc3 = [[Sca3ViewController alloc]init];
    sc3.title = @"第三个";
    
    Sca4ViewController *sc4 = [[Sca4ViewController alloc]init];
    sc4.title = @"第四个";
    
    SCNavTabBarController *scaZhu = [[SCNavTabBarController alloc]init];
    scaZhu.subViewControllers = @[sc1, sc2, sc3, sc4];
    [scaZhu addParentController:self];
    //导航条下方的横线
    _lineView =  [self findlineviw:self.navigationController.navigationBar];
}

你可能感兴趣的:(IOS - 分段控制器SegmentedControl)