PassengerHeaderCell.m 2.29 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9 10 11
//
//  PassengerHeaderCell.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/11/8.
//  Copyright © 2015年 Xummer. All rights reserved.
//

#import "PassengerHeaderCell.h"


12
#define Sale_Header_Height 35
陈俊俊's avatar
陈俊俊 committed
13 14 15 16 17 18 19

@interface PassengerHeaderCell ()
{
    BOOL    hasBuildLayout;         // default, NO;
}

@property (nonatomic, strong) UILabel *label;
陈俊俊's avatar
陈俊俊 committed
20 21
@property (nonatomic, strong) UILabel *searchLabel;

陈俊俊's avatar
陈俊俊 committed
22 23
@property (nonatomic, strong) UIFont *textFont;

陈俊俊's avatar
陈俊俊 committed
24

陈俊俊's avatar
陈俊俊 committed
25 26 27 28 29 30 31 32 33 34 35
@end


@implementation PassengerHeaderCell


+ (CGFloat)viewHeight
{
    return Sale_Header_Height;
}

陈俊俊's avatar
陈俊俊 committed
36
- (void)buildLayout:(NSString *)titleStr
陈俊俊's avatar
陈俊俊 committed
37 38 39 40 41 42
{
    if(hasBuildLayout) {
        return;
    }
    
    if(self.textFont == nil) {
陈俊俊's avatar
陈俊俊 committed
43
        self.textFont = [UIFont systemFontOfSize:13];
陈俊俊's avatar
陈俊俊 committed
44 45 46
    }
    
    hasBuildLayout = YES;
47
    self.contentView.backgroundColor = XXFBgColor;
陈俊俊's avatar
陈俊俊 committed
48
    
49 50 51 52 53 54
    CGRect rect = CGRectMake(0, 0, ScreenSize.width, 1);
    UILabel *lineLabel = [[UILabel alloc]initWithFrame:rect];
    lineLabel.backgroundColor = GXF_LINE_COLOR;
    [self.contentView addSubview:lineLabel];
    
    rect = CGRectMake(10, 0, 150, Sale_Header_Height);
陈俊俊's avatar
陈俊俊 committed
55 56
    UILabel *searLabel = [IBTCommon labelWithTitle:@"" frame:rect textFont:self.textFont];
    searLabel.textColor = ReportTitleColor;
陈俊俊's avatar
陈俊俊 committed
57
    [self.contentView addSubview:searLabel];
陈俊俊's avatar
陈俊俊 committed
58 59
    self.searchLabel = searLabel;

陈俊俊's avatar
陈俊俊 committed
60 61
    
    
陈俊俊's avatar
陈俊俊 committed
62
    CGFloat width = (ScreenSize.width  - searLabel.right - 35)/2;
陈俊俊's avatar
陈俊俊 committed
63
    
陈俊俊's avatar
陈俊俊 committed
64 65 66
    rect = CGRectMake(self.searchLabel.right, 0, width, Sale_Header_Height);
    UILabel * ksjLabel = [IBTCommon labelWithTitle:titleStr frame:rect textFont:self.textFont];
    ksjLabel.textColor = ReportTitleColor;
陈俊俊's avatar
陈俊俊 committed
67 68 69 70 71 72
    ksjLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:ksjLabel];
    
    
    rect = CGRectMake(ksjLabel.right , 0, width, Sale_Header_Height);
    UILabel * bszLabel = [IBTCommon labelWithTitle:@"比上周" frame:rect textFont:self.textFont];
陈俊俊's avatar
陈俊俊 committed
73
    bszLabel.textColor = ReportTitleColor;
陈俊俊's avatar
陈俊俊 committed
74 75
    bszLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:bszLabel];
76 77 78 79 80
    
    rect = CGRectMake(0, Sale_Header_Height-1, ScreenSize.width, 1);
    UILabel *lineTLabel = [[UILabel alloc]initWithFrame:rect];
    lineTLabel.backgroundColor = GXF_LINE_COLOR;
    [self.contentView addSubview:lineTLabel];
陈俊俊's avatar
陈俊俊 committed
81 82
}

陈俊俊's avatar
陈俊俊 committed
83 84 85
- (void)setTotalValue:(NSString *)totalValue{
    self.searchLabel.text = totalValue;
}
陈俊俊's avatar
陈俊俊 committed
86
@end