12306

ViewController.m

#import "ViewController.h"
#import "cheViewController.h"
#import "shangViewController.h"
#import "dingViewController.h"
#import "woViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    cheViewController *che = [[cheViewController alloc]init];
    che.title = @"車票預訂";
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:che];
    nav1.tabBarItem.title = @"車票預訂";
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"Helvetica" size:12.0f],NSFontAttributeName,nil] forState:UIControlStateSelected];
    [[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
    
    shangViewController *shang = [[shangViewController alloc]init];
    shang.title = @"商旅查詢";
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:shang];
    nav2.tabBarItem.title = @"商旅服務";
    
    dingViewController *ding = [[dingViewController alloc]init];
    ding.title = @"訂單查詢";
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:ding];
    nav3.tabBarItem.title = @"訂單查詢";
    
    woViewController *wo = [[woViewController alloc]init];
    wo.title = @"我的12306";
    UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:wo];
    nav4.tabBarItem.title = @"我的12306";
    
    self.viewControllers = @[nav1,nav2,nav3,nav4];
    
}


@end

cheViewController.m

#import "cheViewController.h"
#import "yiTableViewCell.h"
#import "erTableViewCell.h"
#import "sanTableViewCell.h"
#import "siTableViewCell.h"
#import "chaxunViewController.h"


static NSString *celli = @"yide";
static NSString *cellID = @"adad";
static NSString *cellIDs = @"adads";
static NSString *cellIDse = @"adadse";

@interface cheViewController ()<UITableViewDelegate,UITableViewDataSource,SGPageTitleViewDelegate>

{
    UITableView *table;
}

@end

@implementation cheViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];
    table.delegate = self;
    table.dataSource = self;
    
    [table registerClass:[yiTableViewCell class] forCellReuseIdentifier:celli];
    [table registerClass:[erTableViewCell class] forCellReuseIdentifier:cellID];
    [table registerClass:[sanTableViewCell class] forCellReuseIdentifier:cellIDs];
    [table registerClass:[siTableViewCell class] forCellReuseIdentifier:cellIDse];
    [self.view addSubview:table];
    
    
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 6;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 5) {
        return 5;
    }
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        return 100;
    }else if (indexPath.section == 2) {
        return 230;
    }else if (indexPath.section == 3) {
        return 220;
    }
    return 100;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell;
    
    switch (indexPath.section) {
        case 0:
            {
                yiTableViewCell *cells = [tableView dequeueReusableCellWithIdentifier:celli];
                if (!cells) {
                    cells = [[yiTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:celli];
                }
                
                return cells;
            }
            break;
            
        case 1:
        {
            erTableViewCell *cellse = [tableView dequeueReusableCellWithIdentifier:cellID];
            if (!cellse) {
                cellse = [[erTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
            }

            return cellse;
        }
            break;
            
        case 2:
        {
            sanTableViewCell *cellses = [tableView dequeueReusableCellWithIdentifier:cellIDs];
            if (!cellses) {
                cellses = [[sanTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIDs];
            }
            
            return cellses;
        }
            break;
            
        case 3:
        {
            siTableViewCell *cellsesa = [tableView dequeueReusableCellWithIdentifier:cellIDse];
            if (!cellsesa) {
                cellsesa = [[siTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIDse];
            }
            
            [cellsesa.btn2 addTarget:self action:@selector(clicks) forControlEvents:UIControlEventTouchUpInside];
            
            return cellsesa;
            
        }
            break;
            
        default:
            
            cell = [tableView dequeueReusableCellWithIdentifier:@""];
            if (!cell) {
                cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
            }
            
            
            break;
    }
    return cell;
}

-(void)clicks
{
    NSLog(@"查詢");
    chaxunViewController *chaxun = [[chaxunViewController alloc]init];
    chaxun.navigationItem.hidesBackButton = YES;
    [self.navigationController pushViewController:chaxun animated:YES];
}

@end

chaxunViewController.m

#import "chaxunViewController.h"

#define Screenwidth [UIScreen mainScreen].bounds.size.width
#define ScreennHeight [UIScreen mainScreen].bounds.size.height


@interface chaxunViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    BOOL close[30];
}


@property (nonatomic,strong)UILabel *checiLab;
@property (nonatomic,strong)UILabel *kaishiLab;
@property (nonatomic,strong)UILabel *kaishitimeLab;
@property (nonatomic,strong)UILabel *photoLab;
@property (nonatomic,strong)UILabel *jiantouLab;
@property (nonatomic,strong)UILabel *sumtimeLab;
@property (nonatomic,strong)UILabel *jieshuLab;
@property (nonatomic,strong)UILabel *jieshutimeLab;
@property (nonatomic,strong)UILabel *shangwuLab;
@property (nonatomic,strong)UILabel *OneLab;
@property (nonatomic,strong)UILabel *TwoLab;

@property (nonatomic,strong)UIButton *bottomBtn;


@property (nonatomic,strong) UITableView *WBTableView;
@property (nonatomic,strong) NSArray *Close;

@property(nonatomic,strong)UILabel * label1;
@property(nonatomic,strong)UILabel * label2;
@property(nonatomic,strong)UILabel * label3;

@end



@implementation chaxunViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"北京<>上海";
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    UIButton *leftbtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [leftbtn setTitle:@"<" forState:UIControlStateNormal];
    leftbtn.tintColor = [UIColor whiteColor];
    [leftbtn addTarget:self action:@selector(clickleft) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftbtnitem = [[UIBarButtonItem alloc]initWithCustomView:leftbtn];
    self.navigationItem.leftBarButtonItem = leftbtnitem;
    
    
    UIButton *rightbtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightbtn setTitle:@"匚" forState:UIControlStateNormal];
    rightbtn.tintColor = [UIColor whiteColor];
    [rightbtn addTarget:self action:@selector(clickright) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightbtnitem = [[UIBarButtonItem alloc]initWithCustomView:rightbtn];
    self.navigationItem.rightBarButtonItem = rightbtnitem;
    
    
    UIView *view = [[UIView alloc]init];
    view.frame = CGRectMake(0, 64, self.view.frame.size.width, 50);
    view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:view];
    
    _label1 = [[UILabel alloc]init];
    _label1.frame = CGRectMake(0, 0, 100, 50);
    _label1.text = @"      前一天";
    _label1.textColor = [UIColor whiteColor];
    _label1.backgroundColor = [UIColor colorWithRed:90/255.0 green:175/255.0 blue:225/255.0 alpha:1];
    [view addSubview:_label1];
    
    _label2 = [[UILabel alloc]init];
    _label2.frame = CGRectMake(100, 0, 214, 50);
    _label2.text = @"            2017-10-17";
    _label2.font = [UIFont systemFontOfSize:18];
    _label2.textColor = [UIColor whiteColor];
    _label2.backgroundColor = [UIColor colorWithRed:55/255.0 green:145/255.0 blue:205/255.0 alpha:1];
    [view addSubview:_label2];
    
    _label3 = [[UILabel alloc]init];
    _label3.frame = CGRectMake(314, 0, 100, 50);
    _label3.text = @"      后一天";
    _label3.textColor = [UIColor whiteColor];
    _label3.backgroundColor = [UIColor colorWithRed:90/255.0 green:175/255.0 blue:225/255.0 alpha:1];
    [view addSubview:_label3];
    
    //這個的目的是為了使得啟動app時溪掀,單元格是收縮的
    for (int i=0; i<30; i++) {
        close[i] = YES;
    }
    //創(chuàng)建
    _WBTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 114, Screenwidth, ScreennHeight) style:UITableViewStylePlain];
    _WBTableView.dataSource = self;
    _WBTableView.delegate = self;
    
    [self.view addSubview:self.WBTableView];
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 5;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (close[section]) {
        return 0;
    }
    return 5;
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 85;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = [NSString stringWithFormat:@"第%ld組 第%ld行",indexPath.section,indexPath.row];
    return cell;
}

//創(chuàng)建組頭視圖
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIControl *view = [[UIControl alloc] initWithFrame:CGRectMake(0, 0, Screenwidth, 85)];
    view.tag = 1000 + section;
    [view addTarget:self action:@selector(sectionClick:) forControlEvents:UIControlEventTouchUpInside];
    
    _checiLab = [[UILabel alloc]initWithFrame:CGRectMake(8, 8, 50, 30)];
    _checiLab.font = [UIFont systemFontOfSize:21];
    _checiLab.textColor = [UIColor blackColor];
    _kaishiLab = [[UILabel alloc]initWithFrame:CGRectMake(65, 8, 70, 25)];
    _kaishiLab.font = [UIFont systemFontOfSize:13];
    _kaishiLab.textColor = [UIColor blackColor];
    _kaishitimeLab = [[UILabel alloc]initWithFrame:CGRectMake(65, 30, 50, 20)];
    _kaishitimeLab.font = [UIFont systemFontOfSize:11];
    _kaishitimeLab.textColor = [UIColor grayColor];
    _photoLab = [[UILabel alloc]initWithFrame:CGRectMake(210, 5, 50, 25)];
    _photoLab.text = @"????";
    _jiantouLab = [[UILabel alloc]initWithFrame:CGRectMake(195, 20, 100, 10)];
    _jiantouLab.text = @"------->";
    _sumtimeLab = [[UILabel alloc]initWithFrame:CGRectMake(195, 29, 70, 15)];
    _sumtimeLab.font = [UIFont systemFontOfSize:10];
    _sumtimeLab.textColor = [UIColor grayColor];
    _jieshuLab = [[UILabel alloc]initWithFrame:CGRectMake(280, 8, 100, 25)];
    _jieshuLab.font = [UIFont systemFontOfSize:13];
    _jieshuLab.textColor = [UIColor blackColor];
    _jieshutimeLab = [[UILabel alloc]initWithFrame:CGRectMake(280, 30, 50, 20)];
    _jieshutimeLab.font = [UIFont systemFontOfSize:11];
    _jieshutimeLab.textColor = [UIColor grayColor];
    _shangwuLab = [[UILabel alloc]initWithFrame:CGRectMake(8, 55, 60, 20)];
    _shangwuLab.font = [UIFont systemFontOfSize:11];
    _shangwuLab.textColor = [UIColor blackColor];
    _OneLab = [[UILabel alloc]initWithFrame:CGRectMake(108, 55, 60, 20)];
    _OneLab.font = [UIFont systemFontOfSize:11];
    _OneLab.textColor = [UIColor blackColor];
    _TwoLab = [[UILabel alloc]initWithFrame:CGRectMake(208, 55, 60, 20)];
    _TwoLab.font = [UIFont systemFontOfSize:11];
    _TwoLab.textColor = [UIColor blackColor];
    _bottomBtn = [[UIButton alloc]initWithFrame:CGRectMake(364, 11, 50, 50)];
    [_bottomBtn setImage:[UIImage imageNamed:@"xiangxiajiantou_down_9x9_"] forState:UIControlStateNormal];
    
    _checiLab.text = @"G101";
    _kaishiLab.text = @"??北京南";
    _kaishitimeLab.text = @"06:43";
    _sumtimeLab.text = @"05小時56分";
    _jieshuLab.text = @"??上海虹橋";
    _jieshutimeLab.text = @"12:39";
    _shangwuLab.text = @"商務: 4張";
    _OneLab.text = @"一等: 有";
    _TwoLab.text = @"二等: 有";
    
    [view addSubview:self.checiLab];
    [view addSubview:self.kaishiLab];
    [view addSubview:self.kaishitimeLab];
    [view addSubview:self.photoLab];
    [view addSubview:self.jiantouLab];
    [view addSubview:self.sumtimeLab];
    [view addSubview:self.jieshuLab];
    [view addSubview:self.jieshutimeLab];
    [view addSubview:self.shangwuLab];
    [view addSubview:self.OneLab];
    [view addSubview:self.TwoLab];
    [view addSubview:self.bottomBtn];
    
    UIView *vv = [[UIView alloc]initWithFrame:CGRectMake(0, 85, Screenwidth, 1)];
    vv.backgroundColor = [UIColor lightGrayColor];
    [view addSubview:vv];
    
    
    
    
    
    return view;
    
}

/**
 *  cell收縮/展開 刷新
 *
 *  @param view <#view description#>
 */
-(void)sectionClick:(UIControl *)view{
    
    //獲取點擊的組
    NSInteger i = view.tag - 1000;
    //取反
    close[i] = !close[i];
    //刷新列表
    NSIndexSet * index = [NSIndexSet indexSetWithIndex:i];
    [_WBTableView reloadSections:index withRowAnimation:UITableViewRowAnimationAutomatic];
}



-(void)clickleft
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)clickright
{
    NSLog(@"啥");
}



@end

shangViewController.m

#import "shangViewController.h"

@interface shangViewController ()

@end

@implementation shangViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end

yiTableViewCell.h

#import <UIKit/UIKit.h>

@interface yiTableViewCell : UITableViewCell

@property(nonatomic,strong)UIButton *btn1;
@property(nonatomic,strong)UIButton *btn2;
@property(nonatomic,strong)UIButton *btn3;
@property(nonatomic,strong)UIButton *btn4;
@property(nonatomic,strong)UILabel *label1;
@property(nonatomic,strong)UILabel *label2;
@property(nonatomic,strong)UILabel *label3;
@property(nonatomic,strong)UILabel *label4;

@end

yiTableViewCell.m

#import "yiTableViewCell.h"

@implementation yiTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn1.frame = CGRectMake(50, 20, 40, 40);
        _btn1.backgroundColor = [UIColor blueColor];
        [_btn1 addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        _btn1.layer.masksToBounds = YES;
        _btn1.layer.cornerRadius = 20;
        
        _label1 = [[UILabel alloc]init];
        _label1.frame = CGRectMake(50, 70, 50, 10);
        _label1.font = [UIFont systemFontOfSize:12];
        _label1.text = @"正晚點";
        
        _btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn2.frame = CGRectMake(140, 20, 40, 40);
        _btn2.backgroundColor = [UIColor greenColor];
        [_btn2 addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        _btn2.layer.masksToBounds = YES;
        _btn2.layer.cornerRadius = 20;
        
        _label2 = [[UILabel alloc]init];
        _label2.frame = CGRectMake(135, 70, 50, 10);
        _label2.font = [UIFont systemFontOfSize:12];
        _label2.text = @"溫馨服務";
        
        _btn3 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn3.frame = CGRectMake(230, 20, 40, 40);
        _btn3.backgroundColor = [UIColor orangeColor];
        [_btn3 addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        _btn3.layer.masksToBounds = YES;
        _btn3.layer.cornerRadius = 20;
        
        _label3 = [[UILabel alloc]init];
        _label3.frame = CGRectMake(225, 70, 50, 10);
        _label3.font = [UIFont systemFontOfSize:12];
        _label3.text = @"訂餐服務";
        
        _btn4 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn4.frame = CGRectMake(320, 20, 40, 40);
        _btn4.backgroundColor = [UIColor redColor];
        [_btn4 addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        _btn4.layer.masksToBounds = YES;
        _btn4.layer.cornerRadius = 20;
        
        _label4 = [[UILabel alloc]init];
        _label4.frame = CGRectMake(325, 70, 50, 10);
        _label4.font = [UIFont systemFontOfSize:12];
        _label4.text = @"約車";
        
        [self.contentView addSubview:self.btn1];
        [self.contentView addSubview:self.btn2];
        [self.contentView addSubview:self.btn3];
        [self.contentView addSubview:self.btn4];
        [self.contentView addSubview:self.label1];
        [self.contentView addSubview:self.label2];
        [self.contentView addSubview:self.label3];
        [self.contentView addSubview:self.label4];
    }
    return self;
}

-(void)click
{
    NSLog(@"點我");
}

@end

erTableViewCell.h

#import <UIKit/UIKit.h>

@interface erTableViewCell : UITableViewCell

@property(nonatomic,strong)UILabel *label1;
@property(nonatomic,strong)UILabel *label2;
@property(nonatomic,strong)UIImageView *image1;
@end

erTableViewCell.m

#import "erTableViewCell.h"

@implementation erTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _label1 = [[UILabel alloc]init];
        _label1.text = @"北京";
        _label1.frame = CGRectMake(70, 20, 60, 50);
        _label1.font = [UIFont systemFontOfSize:25];
        
        _label2 = [[UILabel alloc]init];
        _label2.text = @"上海";
        _label2.frame = CGRectMake(290, 20, 60, 50);
        _label2.font = [UIFont systemFontOfSize:25];
        
        _image1 = [[UIImageView alloc]init];
        _image1.frame = CGRectMake(180, 35, 40, 30);
        _image1.image = [UIImage imageNamed:@"切片1副本.png"];
        
        [self.contentView addSubview:self.label1];
        [self.contentView addSubview:self.label2];
        [self.contentView addSubview:self.image1];
    }
    return self;
}

@end

sanTableViewCell.h

#import <UIKit/UIKit.h>

@interface sanTableViewCell : UITableViewCell

@property(nonatomic,strong)UILabel *label1;
@property(nonatomic,strong)UILabel *label2;
@property(nonatomic,strong)UILabel *label3;
@property(nonatomic,strong)UILabel *label4;
@property(nonatomic,strong)UILabel *label5;
@property(nonatomic,strong)UILabel *label6;
@property(nonatomic,strong)UILabel *label7;

@end

sanTableViewCell.m

#import "sanTableViewCell.h"

@implementation sanTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _label1 = [[UILabel alloc]init];
        _label1.frame = CGRectMake(50, 30, 70, 20);
        _label1.text = @"出發(fā)日期";
        _label1.textColor = [UIColor grayColor];
        
        _label2 = [[UILabel alloc]init];
        _label2.frame = CGRectMake(50, 100, 70, 20);
        _label2.text = @"出發(fā)時間";
        _label2.textColor = [UIColor grayColor];
        
        _label3 = [[UILabel alloc]init];
        _label3.frame = CGRectMake(50, 170, 70, 20);
        _label3.text = @"席       別";
        _label3.textColor = [UIColor grayColor];
        
        _label4 = [[UILabel alloc]init];
        _label4.frame = CGRectMake(150, 30, 100, 20);
        _label4.text = @"2017-10-17";
        
        _label5 = [[UILabel alloc]init];
        _label5.frame = CGRectMake(150, 100, 100, 20);
        _label5.text = @"00.00-24.00";
        
        _label6 = [[UILabel alloc]init];
        _label6.frame = CGRectMake(150, 170, 100, 20);
        _label6.text = @"不限";
        
        _label7 = [[UILabel alloc]init];
        _label7.frame = CGRectMake(320, 30, 70, 20);
        _label7.text = @"學生";
        
        [self addSubview:self.label1];
        [self addSubview:self.label2];
        [self addSubview:self.label3];
        [self addSubview:self.label4];
        [self addSubview:self.label5];
        [self addSubview:self.label6];
        [self addSubview:self.label7];
    }
    return self;
}

@end

siTableViewCell.h

#import <UIKit/UIKit.h>
#import "SGPagingView.h"

@interface siTableViewCell : UITableViewCell<SGPageTitleViewDelegate>

@property(nonatomic,strong)UIButton *btn1;
@property(nonatomic,strong)UIButton *btn2;
@property(nonatomic,strong)UILabel *label1;
@property(nonatomic,strong)UILabel *label2;
@property(nonatomic,strong)UILabel *label3;
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@end

siTableViewCell.m

#import "siTableViewCell.h"


@implementation siTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        NSArray *titleArr = [@[@"全部", @"G/D/C", @"Z字頭", @"T字頭", @"K字頭", @"其他"]mutableCopy];
        SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
        configure.indicatorAdditionalWidth = 120;
        configure.spacingBetweenButtons = 20;
        configure.titleFont = [UIFont systemFontOfSize:17];
        configure.titleSelectedColor = [UIColor whiteColor];
        configure.indicatorColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
        configure.indicatorScrollStyle = SGIndicatorScrollStyleDefault;
        configure.indicatorStyle = SGIndicatorStyleCover;
        _pageTitleView.isOpenTitleTextZoom = YES;
        self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(10, 0, 394, 44) delegate:self titleNames:titleArr configure:configure];
        [self addSubview:_pageTitleView];
        
        _btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn1.frame = CGRectMake(20, 50, 35, 40);
        _btn1.tintColor = [UIColor orangeColor];
        [_btn1 setTitle:@"?" forState:UIControlStateNormal];
        [_btn1 addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
        
        _label1 = [[UILabel alloc]init];
        _label1.text = @"乘客";
        _label1.textColor = [UIColor orangeColor];
        _label1.frame = CGRectMake(60, 50, 100, 40);
        
        _btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
        _btn2.frame = CGRectMake(10, 100, 394, 50);
        _btn2.backgroundColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
        _btn2.layer.cornerRadius = 10;
        [_btn2 setTitle:@"查詢" forState:UIControlStateNormal];
//        [_btn2 addTarget:self action:@selector(clicks) forControlEvents:UIControlEventTouchUpInside];
        
        _label2 = [[UILabel alloc]init];
        _label2.frame = CGRectMake(10, 160, 394, 40);
        _label2.text = @"-----------------                              -----------------";
        _label2.textColor = [UIColor colorWithRed:0/250.0 green:137/250.0 blue:211/250.0 alpha:1];
        
        _label3 = [[UILabel alloc]init];
        _label3.frame = CGRectMake(155, 160, 130, 40);
        _label3.text = @"最近常用路線";
        _label3.textColor = [UIColor grayColor];
        
        [self addSubview:self.btn1];
        [self addSubview:self.btn2];
        [self addSubview:self.label1];
        [self addSubview:self.label2];
        [self addSubview:self.label3];
    }
    return self;
}

-(void)click
{
    NSLog(@"乘客");
}



@end

wuTableViewCell.h

#import <UIKit/UIKit.h>

@interface wuTableViewCell : UITableViewCell

@property(nonatomic,strong)UILabel * label1;
@property(nonatomic,strong)UILabel * label2;
@property(nonatomic,strong)UILabel * label3;


@end

wuTableViewCell.m

#import "wuTableViewCell.h"

@implementation wuTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _label1 = [[UILabel alloc]init];
        _label1.frame = CGRectMake(0, 0, 100, 50);
        _label1.text = @"      前一天";
        _label1.textColor = [UIColor whiteColor];
        _label1.backgroundColor = [UIColor colorWithRed:90/255.0 green:175/255.0 blue:225/255.0 alpha:1];
        
        _label2 = [[UILabel alloc]init];
        _label2.frame = CGRectMake(100, 0, 214, 50);
        _label2.text = @"            2017-10-17";
        _label2.font = [UIFont systemFontOfSize:18];
        _label2.textColor = [UIColor whiteColor];
        _label2.backgroundColor = [UIColor colorWithRed:55/255.0 green:145/255.0 blue:205/255.0 alpha:1];
        
        _label3 = [[UILabel alloc]init];
        _label3.frame = CGRectMake(314, 0, 100, 50);
        _label3.text = @"      后一天";
        _label3.textColor = [UIColor whiteColor];
        _label3.backgroundColor = [UIColor colorWithRed:90/255.0 green:175/255.0 blue:225/255.0 alpha:1];
        
        [self addSubview:self.label1];
        [self addSubview:self.label2];
        [self addSubview:self.label3];
    }
    return self;
}

@end
切片1副本.png
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市杈帐,隨后出現(xiàn)的幾起案子卖局,更是在濱河造成了極大的恐慌材彪,老刑警劉巖险耀,帶你破解...
    沈念sama閱讀 216,496評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件琳袄,死亡現(xiàn)場離奇詭異,居然都是意外死亡澎办,警方通過查閱死者的電腦和手機嘲碱,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,407評論 3 392
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來局蚀,“玉大人麦锯,你說我怎么就攤上這事±派穑” “怎么了扶欣?”我有些...
    開封第一講書人閱讀 162,632評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長千扶。 經(jīng)常有香客問我料祠,道長,這世上最難降的妖魔是什么澎羞? 我笑而不...
    開封第一講書人閱讀 58,180評論 1 292
  • 正文 為了忘掉前任髓绽,我火速辦了婚禮,結果婚禮上妆绞,老公的妹妹穿的比我還像新娘顺呕。我一直安慰自己枫攀,他們只是感情好,可當我...
    茶點故事閱讀 67,198評論 6 388
  • 文/花漫 我一把揭開白布株茶。 她就那樣靜靜地躺著来涨,像睡著了一般。 火紅的嫁衣襯著肌膚如雪忌卤。 梳的紋絲不亂的頭發(fā)上扫夜,一...
    開封第一講書人閱讀 51,165評論 1 299
  • 那天,我揣著相機與錄音驰徊,去河邊找鬼笤闯。 笑死,一個胖子當著我的面吹牛棍厂,可吹牛的內(nèi)容都是我干的颗味。 我是一名探鬼主播,決...
    沈念sama閱讀 40,052評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼牺弹,長吁一口氣:“原來是場噩夢啊……” “哼浦马!你這毒婦竟也來了?” 一聲冷哼從身側響起张漂,我...
    開封第一講書人閱讀 38,910評論 0 274
  • 序言:老撾萬榮一對情侶失蹤晶默,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后航攒,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體磺陡,經(jīng)...
    沈念sama閱讀 45,324評論 1 310
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,542評論 2 332
  • 正文 我和宋清朗相戀三年漠畜,在試婚紗的時候發(fā)現(xiàn)自己被綠了币他。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,711評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡憔狞,死狀恐怖蝴悉,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情瘾敢,我是刑警寧澤拍冠,帶...
    沈念sama閱讀 35,424評論 5 343
  • 正文 年R本政府宣布,位于F島的核電站簇抵,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏正压。R本人自食惡果不足惜欣福,卻給世界環(huán)境...
    茶點故事閱讀 41,017評論 3 326
  • 文/蒙蒙 一责球、第九天 我趴在偏房一處隱蔽的房頂上張望焦履。 院中可真熱鬧拓劝,春花似錦、人聲如沸嘉裤。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,668評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽屑宠。三九已至厢洞,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間典奉,已是汗流浹背躺翻。 一陣腳步聲響...
    開封第一講書人閱讀 32,823評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留卫玖,地道東北人公你。 一個月前我還...
    沈念sama閱讀 47,722評論 2 368
  • 正文 我出身青樓,卻偏偏與公主長得像假瞬,于是被迫代替她去往敵國和親陕靠。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 44,611評論 2 353

推薦閱讀更多精彩內(nèi)容