Commit 7a31fa40 authored by 陈俊俊's avatar 陈俊俊

报表

parent a36226dd
......@@ -185,6 +185,7 @@
72B3C0DC1B9DBD7500025D81 /* TransportCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3C0DB1B9DBD7500025D81 /* TransportCell.m */; };
72B3C0DF1B9DC60D00025D81 /* TransportDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3C0DE1B9DC60D00025D81 /* TransportDetailViewController.m */; };
72C803521B7B897B00990363 /* DataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 72C803511B7B897B00990363 /* DataManager.m */; };
72D645231BF1E9B80029E146 /* ChooseTransferViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D645221BF1E9B80029E146 /* ChooseTransferViewController.m */; settings = {ASSET_TAGS = (); }; };
72EDD86E1B96E11700964115 /* ChooseParentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EDD86D1B96E11700964115 /* ChooseParentViewController.m */; };
72F56CB21B76EC200077F0C9 /* SurveyUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F56CB11B76EC200077F0C9 /* SurveyUser.m */; };
72F9D47F1BA7E97200795A00 /* NoticeProduct.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9D47E1BA7E97200795A00 /* NoticeProduct.m */; };
......@@ -802,6 +803,8 @@
72B3C0DE1B9DC60D00025D81 /* TransportDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TransportDetailViewController.m; sourceTree = "<group>"; };
72C803501B7B897B00990363 /* DataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataManager.h; sourceTree = "<group>"; };
72C803511B7B897B00990363 /* DataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataManager.m; sourceTree = "<group>"; };
72D645211BF1E9B80029E146 /* ChooseTransferViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseTransferViewController.h; sourceTree = "<group>"; };
72D645221BF1E9B80029E146 /* ChooseTransferViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseTransferViewController.m; sourceTree = "<group>"; };
72EDD86C1B96E11700964115 /* ChooseParentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseParentViewController.h; sourceTree = "<group>"; };
72EDD86D1B96E11700964115 /* ChooseParentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseParentViewController.m; sourceTree = "<group>"; };
72F56CB01B76EC200077F0C9 /* SurveyUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyUser.h; sourceTree = "<group>"; };
......@@ -1517,6 +1520,8 @@
72805D0A1BB8F318009E1F82 /* TransferProductViewController.m */,
72A8132B1BCA8BBA003631F3 /* ChooseTransportViewController.h */,
72A8132C1BCA8BBA003631F3 /* ChooseTransportViewController.m */,
72D645211BF1E9B80029E146 /* ChooseTransferViewController.h */,
72D645221BF1E9B80029E146 /* ChooseTransferViewController.m */,
);
path = Controllers;
sourceTree = "<group>";
......@@ -3028,6 +3033,7 @@
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */,
35CF33951B95B492001211EF /* GXFSearchVendorViewController.m in Sources */,
C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */,
72D645231BF1E9B80029E146 /* ChooseTransferViewController.m in Sources */,
30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */,
C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */,
C142D2B81AC3A155000109A7 /* UIResponder+FirstResponder.m in Sources */,
......@@ -3393,7 +3399,7 @@
baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer: Fanfan Cui (7S27LB84E2)";
CODE_SIGN_IDENTITY = "iPhone Developer: Minglong Hu (TR9LJDJBFT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Minglong Hu (TR9LJDJBFT)";
COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO;
......
......@@ -11,14 +11,14 @@
#define CR_NAME_HOME @"Home"
#define CR_name_BUSINESS @"Business"
#define CR_NAME_STORE @"Report"
#define CR_NAME_Report @"Report"
#define CR_NAME_SYNC @"Message"
#define CR_NAME_SYSTEM @"Me"
typedef NS_ENUM(NSUInteger, CRTapBarItemIndex) {
kCRHome = 0,
kCRBusiness,
kCRStore,
kCRReport,
kCRSync,
kCRSystem,
};
......@@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, CRTapBarItemIndex) {
static NSString * const ACETapBarItemNames[] = {
[ kCRHome ] = CR_NAME_HOME,
[ kCRBusiness ] = CR_name_BUSINESS,
[ kCRStore ] = CR_NAME_STORE,
[ kCRReport ] = CR_NAME_Report,
[ kCRSync ] = CR_NAME_SYNC,
[ kCRSystem ] = CR_NAME_SYSTEM,
};
......
......@@ -13,7 +13,7 @@
#import "ICRLoginViewController.h"
#import "ICRHomeViewController.h"
#import "BusinessViewController.h"
#import "ICRStoreViewController.h"
#import "ReportViewController.h"
#import "ICRSyncViewController.h"
#import "ICRSystemViewController.h"
......@@ -127,7 +127,7 @@
[self createHomeViewController];//首页
[self createBusinessViewController];//业务
[self createStoreViewController];
[self createReportViewController];
[self createSyncViewController];
[self createSystemViewController];
......@@ -179,10 +179,10 @@
navCtrl.title = nsTitle;
}
- (void)createStoreViewController {
NSString *nsTitle = ACETapBarItemNames[ kCRStore ];
- (void)createReportViewController {
NSString *nsTitle = ACETapBarItemNames[ kCRReport ];
ICRStoreViewController *storeVCtrl = [[ICRStoreViewController alloc] init];
ReportViewController *storeVCtrl = [[ReportViewController alloc] init];
[m_arrTabBarBaseViewController addObject:storeVCtrl];
storeVCtrl.title = [IBTCommon localizableString:nsTitle];
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "downSale.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "goSale.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -14,6 +14,8 @@
<string>鲜丰平台</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......@@ -34,8 +36,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
......
......@@ -132,7 +132,6 @@
}
- (void)onLoginTapped:(__unused id)sender {
//
ICRAppDelegate *appDelegate = (ICRAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate comperVersion];
NSString *nsRegisterCode = self.m_containerView.m_cCodeTextF.text;
......
//
// PassengerViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface PassengerViewController : ICRBaseViewController
@end
//
// PassengerViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PassengerViewController.h"
#import "CustomSegView.h"
#import "SMPageControl.h"
#import "PasengerCell.h"
#import "PassengerHeaderCell.h"
#define LeftWidth 50
static NSString *passengerCellIdentify = @"PassengerCellIdentify";
static NSString *passengerHeaderIdentify = @"PassengerHeaderIdentify";
@interface PassengerViewController ()<CustomSegViewDelegate,UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)CustomSegView *segView;
@property (nonatomic,strong)SMPageControl *pageControl;
@property (nonatomic,strong)UIImageView *centerImage;
@property (nonatomic,strong)UILabel *centerLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *lastWeekLabel;
@property (nonatomic,strong)UILabel *lastYearLabel;
@property (nonatomic,strong)UILabel *rateLabel;
@property (nonatomic,strong)UILabel *averageLabel;
@property (nonatomic,strong)UIImageView *lastWeekImage;
@property (nonatomic,strong)UIImageView *lastYearImage;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@end
@implementation PassengerViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self bulidLayout];
}
#pragma mark - 布局
- (void)bulidLayout{
self.view .backgroundColor = [UIColor whiteColor];
CGRect rect = CGRectMake(10, 10, ScreenSize.width - 10*2, 30);
NSArray *arr = @[SaleDay,SaleWeek,SaleMonth];
self.segView = [[CustomSegView alloc]initWithFrame:rect withArr:arr];
self.segView.delegate = self;
[self.view addSubview:self.segView];
rect = CGRectMake(50, self.segView.bottom + 20, 30 , 30);
self.centerImage = [[UIImageView alloc]initWithFrame:rect];
self.centerImage.image = [UIImage imageNamed:@"goSale"];
[self.view addSubview:self.centerImage];
rect = CGRectMake(self.centerImage.right + 5, self.segView.bottom + 20, ScreenSize.width - self.centerImage.right, 30);
self.centerLabel = [[UILabel alloc]initWithFrame:rect];
self.centerLabel.text = @"1290人次";
self.centerLabel.font = [UIFont boldSystemFontOfSize:30];
self.centerLabel.textColor = [UIColor redColor];
[self.view addSubview:self.centerLabel];
rect = CGRectMake(0, self.centerLabel.bottom,ScreenSize.width, 20);
self.dateLabel = [[UILabel alloc]initWithFrame:rect];
self.dateLabel.textColor = GXF_CONTENT_COLOR;
self.dateLabel.font = GXF_FOURTEENTH_SIZE;
self.dateLabel.textAlignment = NSTextAlignmentCenter;
self.dateLabel.text = @"2015-10-21星期一累计客流量";
[self.view addSubview:self.dateLabel];
CGFloat bottomWidth = (ScreenSize.width - 20*2)/2;
rect = CGRectMake(20, self.dateLabel.bottom,40,30);
UILabel *weekLabel = [[UILabel alloc]initWithFrame:rect];
weekLabel.textColor = [UIColor lightGrayColor];
weekLabel.text = @"比上周";
weekLabel.font = GXF_THREETEENTH_SIZE;
[self.view addSubview:weekLabel];
rect = CGRectMake(weekLabel.right, self.dateLabel.bottom,30, 30);
UIImageView *lastImage = [[UIImageView alloc]initWithFrame:rect];
lastImage.image = [UIImage imageNamed:@"goSale"];
[self.view addSubview:lastImage];
self.lastWeekImage = lastImage;
rect = CGRectMake(lastImage.right, lastImage.top,bottomWidth - lastImage.width - weekLabel.width, 30);
self.lastWeekLabel = [[UILabel alloc]initWithFrame:rect];
self.lastWeekLabel.textColor = GXF_CONTENT_COLOR;
self.lastWeekLabel.text = @"13.2%";
self.lastWeekLabel.textColor = [UIColor redColor];
[self.view addSubview:self.lastWeekLabel];
rect = CGRectMake(self.lastWeekLabel.right, self.dateLabel.bottom,40,30);
UILabel *yearLabel = [[UILabel alloc]initWithFrame:rect];
yearLabel.textColor = [UIColor lightGrayColor];
yearLabel.text = @"比去年";
yearLabel.font = GXF_THREETEENTH_SIZE;
[self.view addSubview:yearLabel];
rect = CGRectMake(yearLabel.right, lastImage.top,30, 30);
UIImageView *yearImage = [[UIImageView alloc]initWithFrame:rect];
yearImage.image = [UIImage imageNamed:@"downSale"];
[self.view addSubview:yearImage];
self.lastYearImage = yearImage;
rect = CGRectMake(yearImage.right, lastImage.top,bottomWidth - yearImage.width - yearLabel.width, 30);
self.lastYearLabel = [[UILabel alloc]initWithFrame:rect];
self.lastYearLabel.textColor = GXF_CONTENT_COLOR;
self.lastYearLabel.text = @"13.2%";
self.lastYearLabel.textColor = GXF_NAVIGAYION_COLOR;
[self.view addSubview:self.lastYearLabel];
self.pageControl = [[SMPageControl alloc]initWithFrame:CGRectMake(0, weekLabel.bottom + 5 , self.view.width, 20)];
self.pageControl.currentPage = 0;
self.pageControl.pageIndicatorTintColor = XXFBgColor;
self.pageControl.currentPageIndicatorTintColor = GXF_NAVIGAYION_COLOR;
self.pageControl.numberOfPages = 3;
self.pageControl.currentPage = 1;
self.pageControl.indicatorMargin = 15.0f;
self.pageControl.indicatorDiameter = 15.0f;
[self.view addSubview:self.pageControl];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pageClick)];
[self.pageControl addGestureRecognizer:tap];
CLog(@"%f---------",self.view.height);
rect = CGRectMake(0, self.pageControl.bottom + 5, self.view.width, self.view.height - self.pageControl.bottom - 118);
self.tableView = [[UITableView alloc]initWithFrame:rect style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
// self.tableView.backgroundColor = [UIColor redColor];
[self.tableView registerClass:[PasengerCell class] forCellReuseIdentifier:passengerCellIdentify];
[self.tableView registerClass:[PassengerHeaderCell class] forHeaderFooterViewReuseIdentifier:passengerHeaderIdentify];
[self.view addSubview:self.tableView];
}
#pragma mark - tableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
PasengerCell *cell = (PasengerCell *)[tableView dequeueReusableCellWithIdentifier:passengerCellIdentify forIndexPath:indexPath];
if(cell == nil) {
cell = [[PasengerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:passengerCellIdentify];
}
//没有选中风格
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//取消分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// if(task != nil) {
[cell updateCellWith:nil index:indexPath];
// cell.delegate = self;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [PasengerCell cellHeight];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
PassengerHeaderCell *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:passengerHeaderIdentify];
if (headerView == nil) {
headerView = [[PassengerHeaderCell alloc] initWithReuseIdentifier:passengerHeaderIdentify];
}
[headerView buildLayout];
return headerView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return [PassengerHeaderCell viewHeight];
}
- (void)pageClick{
CLog(@"=====");
}
#pragma mark - segViewDelegate
- (void)customSegOneClick:(NSString *)title{
//日周年切换
}
- (void)customSegTwoClick:(NSString *)title{
//选择历史查看
}
- (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
//
// PassgerPriceViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface PassgerPriceViewController : ICRBaseViewController
@end
//
// PassgerPriceViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PassgerPriceViewController.h"
#import "CustomSegView.h"
#import "SMPageControl.h"
#import "PassgerPriceCell.h"
#import "PassgerPriceHeaderCell.h"
#define LeftWidth 50
static NSString *passgerPriceCellIdentify = @"PassgerPriceCellIdentify";
static NSString *passgerPriceHeaderIdentify = @"PassgerPriceHeaderIdentify";
@interface PassgerPriceViewController ()<CustomSegViewDelegate,UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)CustomSegView *segView;
@property (nonatomic,strong)SMPageControl *pageControl;
@property (nonatomic,strong)UILabel *centerLabel;
@property (nonatomic,strong)UIImageView *centerImage;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *lastWeekLabel;
@property (nonatomic,strong)UILabel *lastYearLabel;
@property (nonatomic,strong)UILabel *rateLabel;
@property (nonatomic,strong)UILabel *averageLabel;
@property (nonatomic,strong)UIImageView *lastWeekImage;
@property (nonatomic,strong)UIImageView *lastYearImage;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong)NSMutableArray *dataArr;
@end
@implementation PassgerPriceViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self bulidLayout];
}
#pragma mark - 布局
- (void)bulidLayout{
self.view .backgroundColor = [UIColor whiteColor];
CGRect rect = CGRectMake(10, 10, ScreenSize.width - 10*2, 30);
NSArray *arr = @[SaleDay,SaleWeek,SaleMonth];
self.segView = [[CustomSegView alloc]initWithFrame:rect withArr:arr];
self.segView.delegate = self;
[self.view addSubview:self.segView];
rect = CGRectMake(50, self.segView.bottom + 20, 30 , 30);
self.centerImage = [[UIImageView alloc]initWithFrame:rect];
self.centerImage.image = [UIImage imageNamed:@"goSale"];
[self.view addSubview:self.centerImage];
rect = CGRectMake(self.centerImage.right + 5, self.segView.bottom + 20, ScreenSize.width - self.centerImage.right, 30);
self.centerLabel = [[UILabel alloc]initWithFrame:rect];
self.centerLabel.text = @"35.68%";
self.centerLabel.font = [UIFont boldSystemFontOfSize:30];
self.centerLabel.textColor = [UIColor redColor];
[self.view addSubview:self.centerLabel];
rect = CGRectMake(0, self.centerLabel.bottom,ScreenSize.width, 20);
self.dateLabel = [[UILabel alloc]initWithFrame:rect];
self.dateLabel.textColor = GXF_CONTENT_COLOR;
self.dateLabel.font = GXF_FOURTEENTH_SIZE;
self.dateLabel.textAlignment = NSTextAlignmentCenter;
self.dateLabel.text = @"2015-10-21星期一累计毛利率";
[self.view addSubview:self.dateLabel];
CGFloat bottomWidth = (ScreenSize.width - 20*2)/2;
rect = CGRectMake(20, self.dateLabel.bottom,40,30);
UILabel *weekLabel = [[UILabel alloc]initWithFrame:rect];
weekLabel.textColor = [UIColor lightGrayColor];
weekLabel.text = @"比上周";
weekLabel.font = GXF_THREETEENTH_SIZE;
[self.view addSubview:weekLabel];
rect = CGRectMake(weekLabel.right, self.dateLabel.bottom,30, 30);
UIImageView *lastImage = [[UIImageView alloc]initWithFrame:rect];
lastImage.image = [UIImage imageNamed:@"goSale"];
[self.view addSubview:lastImage];
self.lastWeekImage = lastImage;
rect = CGRectMake(lastImage.right, lastImage.top,bottomWidth - lastImage.width - weekLabel.width, 30);
self.lastWeekLabel = [[UILabel alloc]initWithFrame:rect];
self.lastWeekLabel.textColor = GXF_CONTENT_COLOR;
self.lastWeekLabel.text = @"13.2%";
self.lastWeekLabel.textColor = [UIColor redColor];
[self.view addSubview:self.lastWeekLabel];
rect = CGRectMake(self.lastWeekLabel.right, self.dateLabel.bottom,40,30);
UILabel *yearLabel = [[UILabel alloc]initWithFrame:rect];
yearLabel.textColor = [UIColor lightGrayColor];
yearLabel.text = @"比去年";
yearLabel.font = GXF_THREETEENTH_SIZE;
[self.view addSubview:yearLabel];
rect = CGRectMake(yearLabel.right, lastImage.top,30, 30);
UIImageView *yearImage = [[UIImageView alloc]initWithFrame:rect];
yearImage.image = [UIImage imageNamed:@"downSale"];
[self.view addSubview:yearImage];
self.lastYearImage = yearImage;
rect = CGRectMake(yearImage.right, lastImage.top,bottomWidth - yearImage.width - yearLabel.width, 30);
self.lastYearLabel = [[UILabel alloc]initWithFrame:rect];
self.lastYearLabel.textColor = GXF_CONTENT_COLOR;
self.lastYearLabel.text = @"13.2%";
self.lastYearLabel.textColor = GXF_NAVIGAYION_COLOR;
[self.view addSubview:self.lastYearLabel];
self.pageControl = [[SMPageControl alloc]initWithFrame:CGRectMake(0, weekLabel.bottom + 5 , self.view.width, 20)];
self.pageControl.currentPage = 0;
self.pageControl.pageIndicatorTintColor = XXFBgColor;
self.pageControl.currentPageIndicatorTintColor = GXF_NAVIGAYION_COLOR;
self.pageControl.numberOfPages = 3;
self.pageControl.indicatorMargin = 15.0f;
self.pageControl.currentPage = 2;
self.pageControl.indicatorDiameter = 15.0f;
[self.view addSubview:self.pageControl];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(pageClick)];
[self.pageControl addGestureRecognizer:tap];
CLog(@"%f---------",self.view.height);
rect = CGRectMake(0, self.pageControl.bottom + 5, self.view.width, self.view.height - self.pageControl.bottom - 118);
self.tableView = [[UITableView alloc]initWithFrame:rect style:UITableViewStylePlain];
self.tableView.delegate = self;
self.tableView.dataSource = self;
// self.tableView.backgroundColor = [UIColor redColor];
[self.tableView registerClass:[PassgerPriceCell class] forCellReuseIdentifier:passgerPriceCellIdentify];
[self.tableView registerClass:[PassgerPriceHeaderCell class] forHeaderFooterViewReuseIdentifier:passgerPriceHeaderIdentify];
[self.view addSubview:self.tableView];
}
#pragma mark - tableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
PassgerPriceCell *cell = (PassgerPriceCell *)[tableView dequeueReusableCellWithIdentifier:passgerPriceCellIdentify forIndexPath:indexPath];
if(cell == nil) {
cell = [[PassgerPriceCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:passgerPriceCellIdentify];
}
//没有选中风格
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//取消分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// if(task != nil) {
[cell updateCellWith:nil index:indexPath];
// cell.delegate = self;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [PassgerPriceCell cellHeight];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
PassgerPriceHeaderCell *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:passgerPriceHeaderIdentify];
if (headerView == nil) {
headerView = [[PassgerPriceHeaderCell alloc] initWithReuseIdentifier:passgerPriceHeaderIdentify];
}
[headerView buildLayout];
return headerView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return [PassgerPriceHeaderCell viewHeight];
}
- (void)pageClick{
CLog(@"=====");
}
#pragma mark - segViewDelegate
- (void)customSegOneClick:(NSString *)title{
//日周年切换
}
- (void)customSegTwoClick:(NSString *)title{
//选择历史查看
}
- (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
//
// ReportViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface ReportViewController : ICRBaseViewController
@end
//
// 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];
//布局
[self bulidLayout];
}
#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
//
// SaleViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface SaleViewController : ICRBaseViewController
@end
//
// CustomSegView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol CustomSegViewDelegate <NSObject>
- (void)customSegOneClick:(NSString *)title;
- (void)customSegTwoClick:(NSString *)title;
@end
@interface CustomSegView : UIView
@property (nonatomic,weak)id<CustomSegViewDelegate>delegate;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
@end
//
// CustomSegView.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/6.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "CustomSegView.h"
#define BeginBtnTag 2000000
@interface CustomSegView ()
{
UIView *_bgView;
NSInteger _currentBtnTag;
}
@property (nonatomic,copy)NSArray *segArr;
@end
@implementation CustomSegView
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr{
self = [super initWithFrame:frame];
if (self) {
self.segArr = arr;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
_bgView = [[UIView alloc]initWithFrame:self.bounds];
_bgView.layer.borderWidth = 1;
_bgView.layer.borderColor = GXF_NAVIGAYION_COLOR.CGColor;
_bgView.layer.cornerRadius = 5;
_bgView.layer.masksToBounds = YES;
[self addSubview:_bgView];
_bgView.clipsToBounds = YES;
_currentBtnTag = 0;
CLog(@"%f",_bgView.width);
CGFloat width = _bgView.width/self.segArr.count;
for (NSInteger i = 0; i < self.segArr.count; i++) {
IBTCustomButtom *segBtn = [IBTCustomButtom buttonWithType:UIButtonTypeCustom];
segBtn.frame = CGRectMake(width*i, 0, width, _bgView.height);
segBtn.titleLabel.font = GXF_FIFTEENTEN_SIZE;
[segBtn setTitleColor:GXF_NAVIGAYION_COLOR forState:UIControlStateNormal];
segBtn.tag = BeginBtnTag + i;
[segBtn setTitle:self.segArr[i] forState:UIControlStateNormal];
[segBtn addTarget:self action:@selector(segClick:) forControlEvents:UIControlEventTouchUpInside];
[_bgView addSubview:segBtn];
if (i == 0) {
segBtn.backgroundColor = GXF_NAVIGAYION_COLOR;
[segBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_currentBtnTag = i+ BeginBtnTag;
}
if (i < self.segArr.count - 1) {
[segBtn addRightBorderWithWidth:1 color:GXF_NAVIGAYION_COLOR];
}
}
}
- (void)segClick:(UIButton *)btn{
if (btn.tag != _currentBtnTag) {
//获取上一个Btn
IBTCustomButtom *beforeBtn = (IBTCustomButtom *)[_bgView viewWithTag:_currentBtnTag];
if ([beforeBtn isKindOfClass:[UIButton class]] && beforeBtn) {
beforeBtn.backgroundColor = RGBA(1, 1, 1, 0);
[beforeBtn setTitleColor:GXF_NAVIGAYION_COLOR forState:UIControlStateNormal];
}
btn.backgroundColor = GXF_NAVIGAYION_COLOR;
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_currentBtnTag = btn.tag;
if ([self.delegate respondsToSelector:@selector(customSegOneClick:)]) {
[self.delegate customSegOneClick:btn.titleLabel.text];
}
}else{
if ([self.delegate respondsToSelector:@selector(customSegTwoClick:)]) {
[self.delegate customSegTwoClick:btn.titleLabel.text];
}
}
}
@end
//
// PasengerCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PasengerCell : UITableViewCell
+ (CGFloat)cellHeight;
- (void)updateCellWith:(id)obj index:(NSIndexPath *)indexPath;
@end
//
// PasengerCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PasengerCell.h"
#define Sale_Cell_Height 50
#define Left_Width 85
#define Left_margin 10
@interface PasengerCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *dqLabel;
@property (nonatomic, strong) UILabel *saleLabel;
@property (nonatomic, strong) UILabel *lastWeekLabel;
@property (nonatomic, strong) UIFont *textFont;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) NSIndexPath *indexPath;
@end
@implementation PasengerCell
+ (CGFloat)cellHeight
{
return Sale_Cell_Height;
}
#pragma mark - build view
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
hasBuildLayout = YES;
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:13];
}
if(self.titleFont == nil) {
self.titleFont = [UIFont systemFontOfSize:17];
}
//页面布局
[self createView];
}
//创建视图
- (void)createView
{
CGRect rect = CGRectMake(Left_margin,0, Left_Width, Sale_Cell_Height);
self.dqLabel = [IBTCommon labelWithTitle:@"0101第一片区" frame:rect textFont:self.textFont];
self.dqLabel.textColor = GXF_NAVIGAYION_COLOR;
[self.contentView addSubview:self.dqLabel];
CGFloat width = (ScreenSize.width - self.dqLabel.width)/2;
rect = CGRectMake(self.dqLabel.right , 0, width, Sale_Cell_Height);
self.saleLabel = [IBTCommon labelWithTitle:@"60.0" frame:rect textFont:self.textFont];
self.saleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.saleLabel];
rect = CGRectMake(self.saleLabel.right, 0, width, Sale_Cell_Height);
self.lastWeekLabel = [IBTCommon labelWithTitle:@"14.20%" frame:rect textFont:self.textFont];
self.lastWeekLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.lastWeekLabel];
UILabel *lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(10, Sale_Cell_Height - 1, ScreenSize.width - 10 * 2, 1))];
lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:lineLabel];
}
#pragma mark - update view
- (void)updateCellWith:(id)policy index:(NSIndexPath *)indexPath
{
self.indexPath = indexPath;
[self buildLayout];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// PassengerHeaderCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PassengerHeaderCell : UITableViewHeaderFooterView
+ (CGFloat)viewHeight;
- (void)buildLayout;
@end
//
// PassengerHeaderCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PassengerHeaderCell.h"
#define Sale_Header_Height 30
@interface PassengerHeaderCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) UIFont *textFont;
@end
@implementation PassengerHeaderCell
+ (CGFloat)viewHeight
{
return Sale_Header_Height;
}
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:15];
}
hasBuildLayout = YES;
self.contentView.backgroundColor = [UIColor lightGrayColor];
CGRect rect = CGRectMake(0, 0, 50, Sale_Header_Height);
UILabel *searLabel = [IBTCommon labelWithTitle:@"280家" frame:rect textFont:self.textFont];
searLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:searLabel];
rect = CGRectMake(searLabel.right, 0,Sale_Header_Height - 5, Sale_Header_Height);
UIImageView *yearImage = [[UIImageView alloc]initWithFrame:rect];
yearImage.image = [UIImage imageNamed:@"search"];
[self.contentView addSubview:yearImage];
CGFloat width = (ScreenSize.width - searLabel.width - yearImage.width - 20)/2;
rect = CGRectMake(yearImage.right + 20 , 0, width, Sale_Header_Height);
UILabel * ksjLabel = [IBTCommon labelWithTitle:@"客单价" frame:rect textFont:self.textFont];
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];
bszLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:bszLabel];
}
@end
//
// PassgerPriceCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PassgerPriceCell : UITableViewCell
+ (CGFloat)cellHeight;
- (void)updateCellWith:(id)obj index:(NSIndexPath *)indexPath;
@end
//
// PassgerPriceCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PassgerPriceCell.h"
#define Sale_Cell_Height 50
#define Left_Width 85
#define Left_margin 10
@interface PassgerPriceCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *dqLabel;
@property (nonatomic, strong) UILabel *saleLabel;
@property (nonatomic, strong) UILabel *lastWeekLabel;
@property (nonatomic, strong) UIFont *textFont;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) NSIndexPath *indexPath;
@end
@implementation PassgerPriceCell
+ (CGFloat)cellHeight
{
return Sale_Cell_Height;
}
#pragma mark - build view
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
hasBuildLayout = YES;
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:13];
}
if(self.titleFont == nil) {
self.titleFont = [UIFont systemFontOfSize:17];
}
//页面布局
[self createView];
}
//创建视图
- (void)createView
{
CGRect rect = CGRectMake(Left_margin,0, Left_Width, Sale_Cell_Height);
self.dqLabel = [IBTCommon labelWithTitle:@"0101第一片区" frame:rect textFont:self.textFont];
self.dqLabel.textColor = GXF_NAVIGAYION_COLOR;
[self.contentView addSubview:self.dqLabel];
CGFloat width = (ScreenSize.width - self.dqLabel.width)/2;
rect = CGRectMake(self.dqLabel.right , 0, width, Sale_Cell_Height);
self.saleLabel = [IBTCommon labelWithTitle:@"60.0" frame:rect textFont:self.textFont];
self.saleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.saleLabel];
rect = CGRectMake(self.saleLabel.right, 0, width, Sale_Cell_Height);
self.lastWeekLabel = [IBTCommon labelWithTitle:@"14.20%" frame:rect textFont:self.textFont];
self.lastWeekLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.lastWeekLabel];
UILabel *lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(10, Sale_Cell_Height - 1, ScreenSize.width - 10 * 2, 1))];
lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:lineLabel];
}
#pragma mark - update view
- (void)updateCellWith:(id)policy index:(NSIndexPath *)indexPath
{
self.indexPath = indexPath;
[self buildLayout];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// PassgerPriceHeaderCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PassgerPriceHeaderCell : UITableViewHeaderFooterView
+ (CGFloat)viewHeight;
- (void)buildLayout;
@end
//
// PassgerPriceHeaderCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "PassgerPriceHeaderCell.h"
#define Sale_Header_Height 30
@interface PassgerPriceHeaderCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) UIFont *textFont;
@end
@implementation PassgerPriceHeaderCell
+ (CGFloat)viewHeight
{
return Sale_Header_Height;
}
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:15];
}
hasBuildLayout = YES;
self.contentView.backgroundColor = [UIColor lightGrayColor];
CGRect rect = CGRectMake(0, 0, 50, Sale_Header_Height);
UILabel *searLabel = [IBTCommon labelWithTitle:@"280家" frame:rect textFont:self.textFont];
searLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:searLabel];
rect = CGRectMake(searLabel.right, 0,Sale_Header_Height - 5, Sale_Header_Height);
UIImageView *yearImage = [[UIImageView alloc]initWithFrame:rect];
yearImage.image = [UIImage imageNamed:@"search"];
[self.contentView addSubview:yearImage];
CGFloat width = (ScreenSize.width - searLabel.width - yearImage.width - 20)/2;
rect = CGRectMake(yearImage.right + 20 , 0, width, Sale_Header_Height);
UILabel * ksjLabel = [IBTCommon labelWithTitle:@"毛利率" frame:rect textFont:self.textFont];
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];
bszLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:bszLabel];
}
@end
//
// SMPageControl.h
// SMPageControl
//
// Created by Jerry Jones on 10/13/12.
// Copyright (c) 2012 Spaceman Labs. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, SMPageControlAlignment) {
SMPageControlAlignmentLeft = 1,
SMPageControlAlignmentCenter,
SMPageControlAlignmentRight
};
typedef NS_ENUM(NSUInteger, SMPageControlVerticalAlignment) {
SMPageControlVerticalAlignmentTop = 1,
SMPageControlVerticalAlignmentMiddle,
SMPageControlVerticalAlignmentBottom
};
@interface SMPageControl : UIControl
@property (nonatomic) NSInteger numberOfPages;
@property (nonatomic) NSInteger currentPage;
@property (nonatomic) CGFloat indicatorMargin UI_APPEARANCE_SELECTOR; // deafult is 10
@property (nonatomic) CGFloat indicatorDiameter UI_APPEARANCE_SELECTOR; // deafult is 6
@property (nonatomic) SMPageControlAlignment alignment UI_APPEARANCE_SELECTOR; // deafult is Center
@property (nonatomic) SMPageControlVerticalAlignment verticalAlignment UI_APPEARANCE_SELECTOR; // deafult is Middle
@property (nonatomic, strong) UIImage *pageIndicatorImage UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *pageIndicatorTintColor UI_APPEARANCE_SELECTOR; // ignored if pageIndicatorImage is set
@property (nonatomic, strong) UIImage *currentPageIndicatorImage UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *currentPageIndicatorTintColor UI_APPEARANCE_SELECTOR; // ignored if currentPageIndicatorImage is set
@property (nonatomic) BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO
@property (nonatomic) BOOL defersCurrentPageDisplay; // if set, clicking to a new page won't update the currently displayed page until -updateCurrentPageDisplay is called. default is NO
- (void)updateCurrentPageDisplay; // update page display to match the currentPage. ignored if defersCurrentPageDisplay is NO. setting the page value directly will update immediately
- (CGRect)rectForPageIndicator:(NSInteger)pageIndex;
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount;
- (void)setImage:(UIImage *)image forPage:(NSInteger)pageIndex;
- (void)setCurrentImage:(UIImage *)image forPage:(NSInteger)pageIndex;
- (UIImage *)imageForPage:(NSInteger)pageIndex;
- (UIImage *)currentImageForPage:(NSInteger)pageIndex;
- (void)updatePageNumberForScrollView:(UIScrollView *)scrollView;
@end
//
// SMPageControl.m
// SMPageControl
//
// Created by Jerry Jones on 10/13/12.
// Copyright (c) 2012 Spaceman Labs. All rights reserved.
//
#import "SMPageControl.h"
#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
#define DEFAULT_INDICATOR_WIDTH 6.0f
#define DEFAULT_INDICATOR_MARGIN 10.0f
@interface SMPageControl ()
@end
@implementation SMPageControl
{
@private
NSInteger _displayedPage;
CGFloat _measuredIndicatorWidth;
CGFloat _measuredIndicatorHeight;
NSMutableDictionary *_pageImages;
NSMutableDictionary *_currentPageImages;
}
- (void)_initialize
{
_numberOfPages = 0;
self.backgroundColor = [UIColor clearColor];
_measuredIndicatorWidth = DEFAULT_INDICATOR_WIDTH;
_measuredIndicatorHeight = DEFAULT_INDICATOR_WIDTH;
_indicatorDiameter = DEFAULT_INDICATOR_WIDTH;
_indicatorMargin = DEFAULT_INDICATOR_MARGIN;
_alignment = SMPageControlAlignmentCenter;
_verticalAlignment = SMPageControlVerticalAlignmentMiddle;
_pageImages = [NSMutableDictionary dictionary];
_currentPageImages = [NSMutableDictionary dictionary];
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (nil == self) {
return nil;
}
[self _initialize];
return self;
}
- (void)awakeFromNib
{
[super awakeFromNib];
[self _initialize];
}
- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
[self _renderPages:context rect:rect];
}
- (void)_renderPages:(CGContextRef)context rect:(CGRect)rect
{
if (_numberOfPages < 2 && _hidesForSinglePage) {
return;
}
CGFloat left = [self _leftOffset];
// CGSize size = [self sizeForNumberOfPages:self.numberOfPages];
// CGContextFillRect(context, CGRectMake(left, 0, size.width, size.height));
CGFloat xOffset = left;
CGFloat yOffset = [self _topOffset];
UIColor *fillColor = nil;
UIImage *image = nil;
for (NSUInteger i = 0; i < _numberOfPages; i++) {
if (i == _displayedPage) {
fillColor = _currentPageIndicatorTintColor ? _currentPageIndicatorTintColor : [UIColor whiteColor];
image = _currentPageImages[@(i)];
if (nil == image) {
image = _currentPageIndicatorImage;
}
} else {
fillColor = _pageIndicatorTintColor ? _pageIndicatorTintColor : [[UIColor whiteColor] colorWithAlphaComponent:0.3f];
image = _pageImages[@(i)];
if (nil == image) {
image = _pageIndicatorImage;
}
}
[fillColor set];
if (image) {
[image drawAtPoint:CGPointMake(xOffset, yOffset)];
} else {
CGContextFillEllipseInRect(context, CGRectMake(xOffset, yOffset, _measuredIndicatorWidth, _measuredIndicatorHeight));
}
xOffset += _measuredIndicatorWidth + _indicatorMargin;
}
// [[UIColor greenColor] set];
// CGContextFillRect(context, CGRectMake(left, 0.0f, [self sizeForNumberOfPages:_numberOfPages].width, 10.0f));
}
- (CGFloat)_leftOffset
{
CGRect rect = self.bounds;
CGSize size = [self sizeForNumberOfPages:self.numberOfPages];
CGFloat left = 0.0f;
switch (_alignment) {
case SMPageControlAlignmentCenter:
left = CGRectGetMidX(rect) - (size.width / 2.0f);
break;
case SMPageControlAlignmentRight:
left = CGRectGetMaxX(rect) - size.width;
break;
default:
break;
}
return left;
}
- (CGFloat)_topOffset
{
CGRect rect = self.bounds;
CGSize size = [self sizeForNumberOfPages:self.numberOfPages];
CGFloat top = 0.0f;
switch (_verticalAlignment) {
case SMPageControlVerticalAlignmentMiddle:
top = CGRectGetMidY(rect) - (_measuredIndicatorHeight / 2.0f);
break;
case SMPageControlVerticalAlignmentBottom:
top = CGRectGetMaxY(rect) - size.height;
break;
default:
break;
}
return top;
}
- (void)updateCurrentPageDisplay
{
_displayedPage = _currentPage;
[self setNeedsDisplay];
}
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount
{
CGFloat marginSpace = MAX(0, pageCount - 1) * _indicatorMargin;
CGFloat indicatorSpace = pageCount * _measuredIndicatorWidth;
return CGSizeMake(marginSpace + indicatorSpace, _measuredIndicatorHeight);
}
- (CGRect)rectForPageIndicator:(NSInteger)pageIndex
{
if (pageIndex < 0 || pageIndex >= _numberOfPages) {
return CGRectZero;
}
CGFloat left = [self _leftOffset];
CGSize size = [self sizeForNumberOfPages:pageIndex + 1];
CGRect rect = CGRectMake(left + size.width - _measuredIndicatorWidth, 0, _measuredIndicatorWidth, _measuredIndicatorWidth);
return rect;
}
- (void)_setImage:(UIImage *)image forPage:(NSInteger)pageIndex current:(BOOL)current
{
if (pageIndex < 0 || pageIndex >= _numberOfPages) {
return;
}
NSMutableDictionary *dictionary = current ? _currentPageImages : _pageImages;
dictionary[@(pageIndex)] = image;
}
- (void)setImage:(UIImage *)image forPage:(NSInteger)pageIndex;
{
[self _setImage:image forPage:pageIndex current:NO];
}
- (void)setCurrentImage:(UIImage *)image forPage:(NSInteger)pageIndex
{
[self _setImage:image forPage:pageIndex current:YES];
}
- (UIImage *)_imageForPage:(NSInteger)pageIndex current:(BOOL)current
{
if (pageIndex < 0 || pageIndex >= _numberOfPages) {
return nil;
}
NSDictionary *dictionary = current ? _currentPageImages : _pageImages;
return dictionary[@(pageIndex)];
}
- (UIImage *)imageForPage:(NSInteger)pageIndex
{
return [self _imageForPage:pageIndex current:NO];
}
- (UIImage *)currentImageForPage:(NSInteger)pageIndex
{
return [self _imageForPage:pageIndex current:YES];
}
- (void)sizeToFit
{
CGRect frame = self.frame;
CGSize size = [self sizeForNumberOfPages:self.numberOfPages];
size.height = MAX(size.height, 36.0f);
frame.size = size;
self.frame = frame;
}
- (void)updatePageNumberForScrollView:(UIScrollView *)scrollView
{
NSInteger page = (int)floorf(scrollView.contentOffset.x / scrollView.frame.size.width);
self.currentPage = page;
}
#pragma mark -
- (void)_updateMeasuredIndicatorSizes
{
_measuredIndicatorWidth = _indicatorDiameter;
_measuredIndicatorHeight = _indicatorDiameter;
// If we're only using images, ignore the _indicatorDiameter
if (self.pageIndicatorImage && self.currentPageIndicatorImage) {
_measuredIndicatorWidth = 0;
_measuredIndicatorHeight = 0;
}
if (self.pageIndicatorImage) {
CGSize imageSize = self.pageIndicatorImage.size;
_measuredIndicatorWidth = MAX(_indicatorDiameter, imageSize.width);
_measuredIndicatorHeight = MAX(_indicatorDiameter, imageSize.height);
}
if (self.currentPageIndicatorImage) {
CGSize imageSize = self.currentPageIndicatorImage.size;
_measuredIndicatorWidth = MAX(_indicatorDiameter, imageSize.width);
_measuredIndicatorHeight = MAX(_indicatorDiameter, imageSize.height);
}
}
#pragma mark - Tap Gesture
// We're using touchesEnded: because we want to mimick UIPageControl as close as possible
// As of iOS 6, UIPageControl still does not use a tap gesture recognizer. This means that actions like
// touching down, sliding around, and releasing, still results in the page incrementing or decrementing.
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
// UITouch *touch = [touches anyObject];
// CGPoint point = [touch locationInView:self];
// CGSize size = [self sizeForNumberOfPages:self.numberOfPages];
// CGFloat left = [self _leftOffset];
// CGFloat middle = left + (size.width / 2.0f);
// if (point.x < middle) {
// [self setCurrentPage:self.currentPage - 1 sendEvent:YES canDefer:YES];
// } else {
// [self setCurrentPage:self.currentPage + 1 sendEvent:YES canDefer:YES];
// }
}
#pragma mark - Accessors
- (void)setFrame:(CGRect)frame
{
[super setFrame:frame];
[self setNeedsDisplay];
}
- (void)setIndicatorDiameter:(CGFloat)indicatorDiameter
{
if (indicatorDiameter == _indicatorDiameter) {
return;
}
_indicatorDiameter = indicatorDiameter;
[self _updateMeasuredIndicatorSizes];
[self setNeedsDisplay];
}
- (void)setIndicatorMargin:(CGFloat)indicatorMargin
{
if (indicatorMargin == _indicatorMargin) {
return;
}
_indicatorMargin = indicatorMargin;
[self setNeedsDisplay];
}
- (void)setNumberOfPages:(NSInteger)numberOfPages
{
if (numberOfPages == _numberOfPages) {
return;
}
_numberOfPages = MAX(0, numberOfPages);
[self setNeedsDisplay];
}
- (void)setCurrentPage:(NSInteger)currentPage
{
[self setCurrentPage:currentPage sendEvent:NO canDefer:NO];
}
- (void)setCurrentPage:(NSInteger)currentPage sendEvent:(BOOL)sendEvent canDefer:(BOOL)defer
{
if (currentPage < 0 || currentPage >= _numberOfPages) {
return;
}
_currentPage = currentPage;
if (NO == self.defersCurrentPageDisplay || NO == defer) {
_displayedPage = _currentPage;
[self setNeedsDisplay];
}
if (sendEvent) {
[self sendActionsForControlEvents:UIControlEventValueChanged];
}
}
- (void)setCurrentPageIndicatorImage:(UIImage *)currentPageIndicatorImage
{
if ([currentPageIndicatorImage isEqual:_currentPageIndicatorImage]) {
return;
}
_currentPageIndicatorImage = currentPageIndicatorImage;
[self _updateMeasuredIndicatorSizes];
[self setNeedsDisplay];
}
- (void)setPageIndicatorImage:(UIImage *)pageIndicatorImage
{
if ([pageIndicatorImage isEqual:_pageIndicatorImage]) {
return;
}
_pageIndicatorImage = pageIndicatorImage;
[self _updateMeasuredIndicatorSizes];
[self setNeedsDisplay];
}
@end
//
// SaleHeaderView.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SaleHeaderView : UITableViewHeaderFooterView
@property (nonatomic,strong)UIButton *searchBtn;
+ (CGFloat)viewHeight;
- (void)buildLayout;
@end
//
// SaleHeaderView.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "SaleHeaderView.h"
#define Sale_Header_Height 30
@interface SaleHeaderView ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) UIFont *textFont;
@end
@implementation SaleHeaderView
+ (CGFloat)viewHeight
{
return Sale_Header_Height;
}
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:15];
}
hasBuildLayout = YES;
self.contentView.backgroundColor = XXFBgColor;
CGRect rect = CGRectMake(0, 0, 50, Sale_Header_Height);
UILabel *searLabel = [IBTCommon labelWithTitle:@"280家" frame:rect textFont:self.textFont];
searLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:searLabel];
rect = CGRectMake(searLabel.right, 0,Sale_Header_Height - 5, Sale_Header_Height);
self.searchBtn = [IBTCommon buttonWithImage:[UIImage imageNamed:@"search"] frame:rect];
[self.contentView addSubview:self.searchBtn];
CGFloat width = (ScreenSize.width - searLabel.width - self.searchBtn.width - 20)/3;
rect = CGRectMake(self.searchBtn.right + 20 , 0, width, Sale_Header_Height);
UIButton * xsBtn = [IBTCommon buttonWithTitle:@"销售额" Image:[UIImage imageNamed:@"arrowdown"] frame:rect fontSize:15 fontColor:[UIColor blackColor]];
[self.contentView addSubview:xsBtn];
rect = CGRectMake(xsBtn.right , 0, width, Sale_Header_Height);
UIButton * bszLabel = [IBTCommon buttonWithTitle:@"比上周" Image:[UIImage imageNamed:@"arrowdown"] frame:rect fontSize:15 fontColor:[UIColor blackColor]];
[self.contentView addSubview:bszLabel];
rect = CGRectMake(bszLabel.right , 0, width, Sale_Header_Height);
UILabel * sclLabel = [IBTCommon labelWithTitle:@"达成率" frame:rect textFont:self.textFont];
sclLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:sclLabel];
}
@end
//
// SaleViewCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SaleViewCell : UITableViewCell
+ (CGFloat)cellHeight;
- (void)updateCellWith:(id)obj index:(NSIndexPath *)indexPath;
@end
//
// SaleViewCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/8.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "SaleViewCell.h"
#define Sale_Cell_Height 50
#define Left_Width 85
#define Left_margin 10
@interface SaleViewCell ()
{
BOOL hasBuildLayout; // default, NO;
}
@property (nonatomic, strong) UILabel *dqLabel;
@property (nonatomic, strong) UILabel *saleLabel;
@property (nonatomic, strong) UILabel *lastWeekLabel;
@property (nonatomic, strong) UILabel *rateLabel;
@property (nonatomic, strong) UIFont *textFont;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) NSIndexPath *indexPath;
@end
@implementation SaleViewCell
+ (CGFloat)cellHeight
{
return Sale_Cell_Height;
}
#pragma mark - build view
- (void)buildLayout
{
if(hasBuildLayout) {
return;
}
hasBuildLayout = YES;
if(self.textFont == nil) {
self.textFont = [UIFont systemFontOfSize:13];
}
if(self.titleFont == nil) {
self.titleFont = [UIFont systemFontOfSize:17];
}
//页面布局
[self createView];
}
//创建视图
- (void)createView
{
CGRect rect = CGRectMake(Left_margin,0, Left_Width, Sale_Cell_Height);
self.dqLabel = [IBTCommon labelWithTitle:@"0101第一片区" frame:rect textFont:self.textFont];
self.dqLabel.textColor = GXF_NAVIGAYION_COLOR;
[self.contentView addSubview:self.dqLabel];
CGFloat width = (ScreenSize.width - self.dqLabel.width)/3;
rect = CGRectMake(self.dqLabel.right , 0, width, Sale_Cell_Height);
self.saleLabel = [IBTCommon labelWithTitle:@"56,080" frame:rect textFont:self.textFont];
self.saleLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.saleLabel];
rect = CGRectMake(self.saleLabel.right, 0, width, Sale_Cell_Height);
self.lastWeekLabel = [IBTCommon labelWithTitle:@"14.20%" frame:rect textFont:self.textFont];
self.lastWeekLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.lastWeekLabel];
rect = CGRectMake(self.lastWeekLabel.right, 0, width, Sale_Cell_Height);
self.rateLabel = [IBTCommon labelWithTitle:@"60%" frame:rect textFont:self.textFont];
self.rateLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.rateLabel];
UILabel *lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(10, Sale_Cell_Height - 1, ScreenSize.width - 10 * 2, 1))];
lineLabel.backgroundColor = GXF_LINE_COLOR;
[self.contentView addSubview:lineLabel];
}
#pragma mark - update view
- (void)updateCellWith:(id)policy index:(NSIndexPath *)indexPath
{
self.indexPath = indexPath;
[self buildLayout];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// ChooseTransferViewController.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/10.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
typedef void(^ChooseTransferProduct)(NSArray *products);
@interface ChooseTransferViewController : ICRBaseViewController
@property (nonatomic,copy)ChooseTransferProduct chooseTransferProduct;
@end
//
// ChooseTransferViewController.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/10.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ChooseTransferViewController.h"
@interface ChooseTransferViewController ()
@end
@implementation ChooseTransferViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment