ReportViewController.m 2.82 KB
Newer Older
陈俊俊's avatar
陈俊俊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
//
//  ReportViewController.m
//  XFFruit
//
//  Created by 陈俊俊 on 15/11/6.
//  Copyright © 2015年 Xummer. All rights reserved.
// 报表

#import "ReportViewController.h"
#import "SaleViewController.h"
#import "PassengerViewController.h"
#import "PassgerPriceViewController.h"

@interface ReportViewController ()<UIScrollViewDelegate>
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,assign)NSInteger currentPage;
@end

@implementation ReportViewController

- (instancetype)init{
    self = [super init];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollToCurrent) name:@"ReportScrollToCurrent" object:nil];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //布局
陈俊俊's avatar
陈俊俊 committed
32
#if 0
陈俊俊's avatar
陈俊俊 committed
33
    [self bulidLayout];
陈俊俊's avatar
陈俊俊 committed
34 35 36 37 38 39 40 41 42
#else 
    CGRect rect = CGRectMake(0, 200, self.view.width, 30);
    IBTUILabel *lbl = [[IBTUILabel alloc]initWithFrame:rect];
    lbl.text = @"哎呦,功能还没实现呢,下次再来看看吧。";
    lbl.textAlignment = NSTextAlignmentCenter;
    lbl.font = [UIFont systemFontOfSize:15];
    lbl.textColor = GXF_NAVIGAYION_COLOR;
    [self.view addSubview:lbl];
#endif
陈俊俊's avatar
陈俊俊 committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
}

#pragma mark - 布局
- (void)bulidLayout{
    
    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 49 - 64)];
    self.scrollView.delegate = self;
    self.scrollView.showsHorizontalScrollIndicator  = NO;
    self.scrollView.showsVerticalScrollIndicator = NO;
    self.scrollView.pagingEnabled = YES;
    [self.view addSubview:self.scrollView];
    
    
    SaleViewController *svc = [SaleViewController new];
    [self addChildViewController:svc];
    
    PassengerViewController *pvc = [PassengerViewController new];
    [self addChildViewController:pvc];
    
    PassgerPriceViewController *ppvc = [PassgerPriceViewController new];
    [self addChildViewController:ppvc];
    
    
    CGRect rect = CGRectMake(0, 0, ScreenSize.width, self.scrollView.height);
    svc.view.frame = rect;
    [self.scrollView addSubview:svc.view];
    
    rect = CGRectMake(self.scrollView.width,0 , ScreenSize.width, self.scrollView.height);
    pvc.view.frame = rect;
    [self.scrollView addSubview:pvc.view];
    
    rect = CGRectMake(self.scrollView.width*2, 0, ScreenSize.width, self.scrollView.height);
    ppvc.view.frame = rect;
    [self.scrollView addSubview:ppvc.view];
    
    self.scrollView.contentSize = CGSizeMake(self.scrollView.width * 3, self.scrollView.height);
    
}


- (void)scrollToCurrent{
    
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    CLog(@"%f",scrollView.contentOffset.x/scrollView.width);
    NSInteger currentPage = scrollView.contentOffset.x/scrollView.width;
    self.currentPage = currentPage;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end