Commit eb172c88 authored by n22's avatar n22

列表

parent d7a36d15
......@@ -352,6 +352,13 @@
FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; };
FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */; };
FEA2F3001B842A1C00D64735 /* MaterialVIewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */; };
FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3021B8453C700D64735 /* GoodsViewController.m */; };
FEA2F3061B8453DE00D64735 /* CostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3051B8453DE00D64735 /* CostViewController.m */; };
FEA2F3091B8459DA00D64735 /* HeaderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3081B8459DA00D64735 /* HeaderCell.m */; };
FEA2F30C1B84687D00D64735 /* FooterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F30B1B84687D00D64735 /* FooterCell.m */; };
FEA2F30F1B846F0100D64735 /* MaterialCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F30E1B846F0100D64735 /* MaterialCell.m */; };
FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16E81B79C9F9009D9E01 /* ResultView.m */; };
FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EB1B79CAA0009D9E01 /* TPCustomImageVIew.m */; };
FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEAE16EE1B79CAE3009D9E01 /* SingleScrollView.m */; };
......@@ -753,6 +760,20 @@
FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
FEA2F2FB1B8423B900D64735 /* BottomSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomSheetView.h; sourceTree = "<group>"; };
FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomSheetView.m; sourceTree = "<group>"; };
FEA2F2FE1B842A1C00D64735 /* MaterialVIewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialVIewController.h; sourceTree = "<group>"; };
FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MaterialVIewController.m; sourceTree = "<group>"; };
FEA2F3011B8453C700D64735 /* GoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoodsViewController.h; sourceTree = "<group>"; };
FEA2F3021B8453C700D64735 /* GoodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodsViewController.m; sourceTree = "<group>"; };
FEA2F3041B8453DE00D64735 /* CostViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CostViewController.h; sourceTree = "<group>"; };
FEA2F3051B8453DE00D64735 /* CostViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CostViewController.m; sourceTree = "<group>"; };
FEA2F3071B8459DA00D64735 /* HeaderCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeaderCell.h; sourceTree = "<group>"; };
FEA2F3081B8459DA00D64735 /* HeaderCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HeaderCell.m; sourceTree = "<group>"; };
FEA2F30A1B84687D00D64735 /* FooterCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FooterCell.h; sourceTree = "<group>"; };
FEA2F30B1B84687D00D64735 /* FooterCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FooterCell.m; sourceTree = "<group>"; };
FEA2F30D1B846F0100D64735 /* MaterialCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialCell.h; sourceTree = "<group>"; };
FEA2F30E1B846F0100D64735 /* MaterialCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MaterialCell.m; sourceTree = "<group>"; };
FEAE16E71B79C9F9009D9E01 /* ResultView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultView.h; sourceTree = "<group>"; };
FEAE16E81B79C9F9009D9E01 /* ResultView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResultView.m; sourceTree = "<group>"; };
FEAE16EA1B79CAA0009D9E01 /* TPCustomImageVIew.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCustomImageVIew.h; sourceTree = "<group>"; };
......@@ -914,6 +935,12 @@
children = (
72C8034A1B7B72DB00990363 /* AddWorkSheetViewController.h */,
72C8034B1B7B72DB00990363 /* AddWorkSheetViewController.m */,
FEA2F2FE1B842A1C00D64735 /* MaterialVIewController.h */,
FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */,
FEA2F3011B8453C700D64735 /* GoodsViewController.h */,
FEA2F3021B8453C700D64735 /* GoodsViewController.m */,
FEA2F3041B8453DE00D64735 /* CostViewController.h */,
FEA2F3051B8453DE00D64735 /* CostViewController.m */,
);
name = Controllers;
path = XFFruit/ViewControllers/WorkSheet/Controllers;
......@@ -932,6 +959,14 @@
children = (
72C8034D1B7B735300990363 /* TopSheetView.h */,
72C8034E1B7B735300990363 /* TopSheetView.m */,
FEA2F2FB1B8423B900D64735 /* BottomSheetView.h */,
FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */,
FEA2F3071B8459DA00D64735 /* HeaderCell.h */,
FEA2F3081B8459DA00D64735 /* HeaderCell.m */,
FEA2F30A1B84687D00D64735 /* FooterCell.h */,
FEA2F30B1B84687D00D64735 /* FooterCell.m */,
FEA2F30D1B846F0100D64735 /* MaterialCell.h */,
FEA2F30E1B846F0100D64735 /* MaterialCell.m */,
);
name = Views;
path = XFFruit/ViewControllers/WorkSheet/Views;
......@@ -1945,6 +1980,7 @@
FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */,
C182E40E1AD4CE0B009BB9DB /* IBTModel.m in Sources */,
C1FE50411AE0240300C18080 /* IBTAVAudioPlayWrapper.m in Sources */,
FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */,
7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */,
C159184B1AC062460013B391 /* IBTTabBarController.m in Sources */,
C142D2BE1AC3A155000109A7 /* UIView+FindUIViewController.m in Sources */,
......@@ -1962,6 +1998,7 @@
C1B810AF1ADF4D6A00BBC75A /* ICRAttachTitleView.m in Sources */,
C159186F1AC1A0510013B391 /* ICRSystemViewController.m in Sources */,
C142D2C51AC3A16C000109A7 /* ICRBaseViewController.m in Sources */,
FEA2F3001B842A1C00D64735 /* MaterialVIewController.m in Sources */,
C123A91D1B25E3F1003C0C36 /* ICRPatrolResultViewController.m in Sources */,
C1E108651ADAD2F200620375 /* IBTUIScrollView.m in Sources */,
7217E9E51B72364300FE5C1D /* NewSurveyViewController.m in Sources */,
......@@ -1986,6 +2023,7 @@
72C803521B7B897B00990363 /* DataManager.m in Sources */,
C1C5643E1AD62BD8006A1050 /* ICRPlaceholderTextView.m in Sources */,
307059D21AF2211300E9DB8E /* ICRSyncCellContentView.m in Sources */,
FEA2F30F1B846F0100D64735 /* MaterialCell.m in Sources */,
0406BFD91B7C97E700DD65A7 /* BusinessViewController.m in Sources */,
C1374F581B33C40D00594D19 /* IBTWebViewController.m in Sources */,
C159186B1AC1A03B0013B391 /* ICRSyncViewController.m in Sources */,
......@@ -2068,14 +2106,17 @@
C142D2B81AC3A155000109A7 /* UIResponder+FirstResponder.m in Sources */,
30D3C1251ADF6451004AC54E /* ICRAnnouncementDetailContentView.m in Sources */,
FEAE16E91B79C9F9009D9E01 /* ResultView.m in Sources */,
FEA2F30C1B84687D00D64735 /* FooterCell.m in Sources */,
C142D2C01AC3A155000109A7 /* UIView+ViewFrameGeometry.m in Sources */,
C1FE50451AE0249A00C18080 /* IBTImagePicker.m in Sources */,
FEA2F3091B8459DA00D64735 /* HeaderCell.m in Sources */,
C1E108611ADA8D3800620375 /* ICRAttachment.m in Sources */,
C159187C1AC435DF0013B391 /* IBTAdditionsObserver.m in Sources */,
C18AEA8C1AC9855400A1DB7B /* IBTLoadingView.m in Sources */,
C10C90A11AE5751D00B911CD /* ICRPost.m in Sources */,
7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */,
C1FE50351AE020D400C18080 /* IBTAudioController.m in Sources */,
FEA2F3061B8453DE00D64735 /* CostViewController.m in Sources */,
C14BE3061ADB84350049F1AA /* IBTTextFieldCell.m in Sources */,
30F7F5711ADE723100A9B24E /* ICRAttachmentCellContentView.m in Sources */,
C15918451AC062460013B391 /* IBTBadgeView.m in Sources */,
......@@ -2093,6 +2134,7 @@
C1C5644F1AD6719B006A1050 /* ICRTaskDetailViewController.m in Sources */,
C1E1085D1ADA577500620375 /* ICRTaskDetailContentView.m in Sources */,
C14BE30E1ADB86DB0049F1AA /* NSData+EncodeAdditions.m in Sources */,
FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */,
FE0C9B091B7C543D00335B39 /* User.m in Sources */,
C1E093041AC8E8E0003B7126 /* ICRCheckBox.m in Sources */,
C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */,
......
......@@ -8,21 +8,24 @@
#import "AddWorkSheetViewController.h"
#import "TopSheetView.h"
#import "BottomSheetView.h"
#define TopHeight 284
#define BottomHeight 300
#define SpaceHeight 20
#define ContentHeight 44
#define BeginTag 7000
#define SpaceWidth 20
#define BtnWidth (ScreenSize.width - 20*4)/3
#define BottomViewHeight 60
typedef enum : NSUInteger {
SaveTag = 7000,
CommitTag,
} BtnTag;
@interface AddWorkSheetViewController ()<TopSheetViewDelegate,UIScrollViewDelegate>
{
UIScrollView *_scrollView;
TopSheetView *_sheetView;
UIView *_bottomView;
UIScrollView *_bottomSV;
UIImageView *_moveImageView;
BottomSheetView *_bottomView;
}
@end
......@@ -35,74 +38,34 @@
}
- (void)bulidLayout{
self.view.backgroundColor = XXFBgColor;
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0, ScreenSize.width, ScreenSize.height- 64)];
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0, ScreenSize.width, ScreenSize.height- 64 - BottomViewHeight )];
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.contentSize = CGSizeMake(ScreenSize.width, TopHeight+ BottomHeight + SpaceHeight*2);
[self.view addSubview:_scrollView];
UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, ScreenSize.height - BottomViewHeight - 64, ScreenSize.width, BottomViewHeight)];
UIButton *saveBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:SaveTag image:nil title:@"保存" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"50bd62")];
[footView addSubview:saveBtn];
UIButton *commitBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetMaxX(saveBtn.frame) + 15, 8, (ScreenSize.width - 15*3)/2, 44) target:self sel:@selector(btnClick:) tag:CommitTag image:nil title:@"提交" titleColor: [UIColor whiteColor] isCorner:YES corner:5 bgColor:HexColor(@"f69100")];
[footView addSubview:commitBtn];
[self.view addSubview:footView];
_sheetView = [[TopSheetView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, TopHeight)];
_sheetView.delegate = self;
[_scrollView addSubview:_sheetView];
_bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_sheetView.frame) + 20, ScreenSize.width,BottomHeight)];
_bottomView = [[BottomSheetView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_sheetView.frame) + 20, ScreenSize.width,BottomHeight)];
_bottomView.backgroundColor = [UIColor whiteColor];
[_scrollView addSubview:_bottomView];
[self createBottomView];
}
- (void)createBottomView{
NSArray *arr = @[@"原料明细",@"成品明细",@"费用明细"];
_bottomSV = [[UIScrollView alloc]initWithFrame:CGRectMake(0,ContentHeight + 4, ScreenSize.width, CGRectGetHeight(_bottomView.frame) - ContentHeight-2 )];
_bottomSV.showsHorizontalScrollIndicator = NO;
_bottomSV.showsVerticalScrollIndicator = NO;
_bottomSV.pagingEnabled = YES;
_bottomSV.delegate = self;
_bottomSV.backgroundColor = [UIColor yellowColor];
_bottomSV.contentSize = CGSizeMake(ScreenSize.width * arr.count, CGRectGetHeight(_bottomSV.frame));
[_bottomView addSubview:_bottomSV];
for (NSInteger i = 0; i < arr.count; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:arr[i] forState:UIControlStateNormal];
btn.frame = CGRectMake(SpaceWidth + (BtnWidth+SpaceWidth) * i, 0, BtnWidth, ContentHeight);
[btn setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
btn.titleLabel.font = FontSize(16);
btn.tag = i + BeginTag;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[_bottomView addSubview:btn];
UIView *image = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetWidth(_bottomSV.frame) * i, 0, CGRectGetWidth(_bottomSV.frame), CGRectGetHeight(_bottomSV.frame))];
if (i == 0) {
image.backgroundColor = [UIColor redColor];
}else if(i == 1){
image.backgroundColor = [UIColor blackColor];
}else if(i == 2){
image.backgroundColor = [UIColor blueColor];
}
[_bottomSV addSubview:image];
}
_moveImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SpaceWidth, ContentHeight, BtnWidth,4)];
_moveImageView.image = [UIImage imageNamed:@"tab_line"];
[_bottomView addSubview:_moveImageView];
}
- (void)btnClick:(UIButton *)btn{
NSInteger index = btn.tag - BeginTag;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * index;
_moveImageView.frame = moveFrame;
}];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
if (scrollView == _bottomSV) {
// CGFloat index = _bottomSV.contentOffset.x / _bottomSV.frame.size.width;
}
}
......
//
// CostViewController.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface CostViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *costArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@end
//
// CostViewController.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "CostViewController.h"
#import "HeaderCell.h"
#import "FooterCell.h"
@interface CostViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
}
@end
@implementation CostViewController
- (void)viewDidLoad {
self.view.backgroundColor = XXFBgColor;
[super viewDidLoad];
_costArr = [NSMutableArray array];
[self createView];
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"费用",@"应付金额",@"已付金额"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell;
FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加原料明细"];
[self.view addSubview:footCell];
footCell.delegate = self;
self.tableView.tableFooterView = footCell;
}
- (void)addClick{
[self.costArr addObject:@"dddd"];
[self.tableView reloadData];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.costArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
cell.textLabel.text = @"3333333";
return cell;
}
/*
#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
//
// GoodsViewController.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface GoodsViewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *goodsArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@end
//
// GoodsViewController.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "GoodsViewController.h"
#import "HeaderCell.h"
#import "FooterCell.h"
@interface GoodsViewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
}
@end
@implementation GoodsViewController
- (void)viewDidLoad {
self.view.backgroundColor = XXFBgColor;
[super viewDidLoad];
_goodsArr = [NSMutableArray array];
[self createView];
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.backgroundColor = [UIColor whiteColor];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"原料",@"基础数量",@"出库时间"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell;
FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加原料明细"];
[self.view addSubview:footCell];
footCell.delegate = self;
self.tableView.tableFooterView = footCell;
}
- (void)addClick{
[self.goodsArr addObject:@"dddd"];
[self.tableView reloadData];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.goodsArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"cellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
cell.textLabel.text = @"3333333";
return cell;
}
/*
#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
//
// MaterialVIewController.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "ICRBaseViewController.h"
@interface MaterialVIewController : ICRBaseViewController
@property (nonatomic,strong)NSMutableArray *meterialArr;
@property (nonatomic,strong)UITableView *tableView;
@property (nonatomic,assign)CGRect viewFrame;
@end
//
// MaterialVIewController.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "MaterialVIewController.h"
#import "HeaderCell.h"
#import "FooterCell.h"
#import "MaterialCell.h"
#define TableHeight 44
@interface MaterialVIewController ()<UITableViewDataSource,UITableViewDelegate,FooterCellDelegate>
{
CGRect _tableFrame;
NSInteger _currentRow;
BOOL isFirst;
}
@end
@implementation MaterialVIewController
- (void)viewDidLoad {
self.view.backgroundColor = XXFBgColor;
[super viewDidLoad];
isFirst = YES;
_meterialArr = [NSMutableArray array];
[self createView];
}
- (void)setViewFrame:(CGRect)viewFrame{
_tableFrame = viewFrame;
}
- (void)createView{
self.tableView = [[UITableView alloc]initWithFrame:_tableFrame style:(UITableViewStylePlain)];
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.view addSubview:self.tableView];
NSArray *arr = @[@"原料",@"基础数量",@"入库时间"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
[self.view addSubview:headCell];
self.tableView.tableHeaderView = headCell;
FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加原料明细"];
[self.view addSubview:footCell];
footCell.delegate = self;
self.tableView.tableFooterView = footCell;
}
- (void)addClick{
[self.meterialArr addObject:@"dddd"];
[self.tableView reloadData];
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.meterialArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"MaterialCell";
MaterialCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[MaterialCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
}
if (indexPath.row != _currentRow) {
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = TableHeight-1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 0;
cell.showView.frame = showfrmame;
cell.showView.hidden = YES;
cell.backgroundColor = [UIColor whiteColor];
}else if (indexPath.row == _currentRow && !isFirst)
{
CGRect Linefrmame = cell.lineLabel.frame;
Linefrmame.origin.y = 200-1;
cell.lineLabel.frame = Linefrmame;
CGRect showfrmame = cell.showView.frame;
showfrmame.size.height = 150;
cell.showView.frame = showfrmame;
cell.showView.hidden = NO;
cell.backgroundColor = XXFBgColor;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
MaterialCell *cell = (MaterialCell *)[tableView cellForRowAtIndexPath:indexPath];
CGRect Linefrmame = cell.lineLabel.frame;
CGRect showfrmame = cell.showView.frame;
if (Linefrmame.origin.y == TableHeight - 1) {
Linefrmame.origin.y = 200-1;
showfrmame.size.height = 150;
cell.showView.hidden = NO;
isFirst = NO;
cell.backgroundColor = [UIColor whiteColor];
}else{
isFirst = YES;
Linefrmame.origin.y = TableHeight -1;
showfrmame.size.height = 0;
cell.showView.hidden = YES;
cell.backgroundColor = XXFBgColor;
}
cell.lineLabel.frame = Linefrmame;
cell.showView.frame = showfrmame;
_currentRow = indexPath.row;
[self.tableView reloadData];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row == _currentRow && !isFirst) {
return 200;
}
return TableHeight;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
// BottomSheetView.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface BottomSheetView : UIView
@end
//
// BottomSheetView.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "BottomSheetView.h"
#import "MaterialVIewController.h"
#import "GoodsViewController.h"
#import "CostViewController.h"
#define ContentHeight 44
#define BtnWidth (ScreenSize.width - 20*4)/3
#define BeginTag 8000
#define SpaceWidth 20
@interface BottomSheetView ()<UIScrollViewDelegate>
{
UIScrollView *_bottomSV;
UIImageView *_moveImageView;
UIButton *_currentBtn;
UIButton *_addBtn;
MaterialVIewController *_materialVC;
GoodsViewController *_goodsVC;
CostViewController *_costVC;
}
@end
@implementation BottomSheetView
- (instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
//界面
[self bulidLayout];
}
return self;
}
#pragma mark - 布局
- (void)bulidLayout
{
[self addChildView];
[self createBottomView];
}
- (void)createBottomView{
NSArray *arr = @[@"原料明细",@"成品明细",@"费用明细"];
_bottomSV = [[UIScrollView alloc]initWithFrame:CGRectMake(0,ContentHeight + 4, ScreenSize.width, CGRectGetHeight(self.frame) - ContentHeight-2)];
_bottomSV.showsHorizontalScrollIndicator = NO;
_bottomSV.showsVerticalScrollIndicator = NO;
_bottomSV.pagingEnabled = YES;
_bottomSV.delegate = self;
_bottomSV.backgroundColor = [UIColor yellowColor];
_bottomSV.contentSize = CGSizeMake(ScreenSize.width * arr.count, CGRectGetHeight(_bottomSV.frame));
[self addSubview:_bottomSV];
for (NSInteger i = 0; i < arr.count; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
[btn setTitle:arr[i] forState:UIControlStateNormal];
btn.frame = CGRectMake(SpaceWidth + (BtnWidth+SpaceWidth) * i, 0, BtnWidth, ContentHeight);
[btn setTitleColor:HexColor(@"444444") forState:UIControlStateNormal];
[btn setTitleColor:HexColor(@"50bd62") forState:UIControlStateDisabled];
btn.titleLabel.font = FontSize(16);
btn.tag = i + BeginTag;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetWidth(_bottomSV.frame) * i, 0, CGRectGetWidth(_bottomSV.frame), CGRectGetHeight(_bottomSV.frame))];
if (i == 0) {
view.backgroundColor = [UIColor redColor];
_materialVC.viewFrame = view.bounds;
[view addSubview:_materialVC.view];
}else if(i == 1){
view.backgroundColor = [UIColor blackColor];
_goodsVC.viewFrame = view.bounds;
[view addSubview:_goodsVC.view];
}else if(i == 2){
_costVC.viewFrame = view.bounds;
[view addSubview:_costVC.view];
view.backgroundColor = [UIColor blueColor];
}
[_bottomSV addSubview:view];
}
_moveImageView = [[UIImageView alloc]initWithFrame:CGRectMake(SpaceWidth, ContentHeight, BtnWidth,4)];
_moveImageView.image = [UIImage imageNamed:@"tab_line"];
[self addSubview:_moveImageView];
}
- (void)addChildView{
_materialVC = [[MaterialVIewController alloc]init];
_goodsVC = [[GoodsViewController alloc]init];
_costVC = [[CostViewController alloc]init];
}
- (void)btnClick:(UIButton *)btn{
NSInteger index = btn.tag - BeginTag;
_currentBtn.enabled = YES;
btn.enabled = NO;
_currentBtn = btn;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * index;
_moveImageView.frame = moveFrame;
_bottomSV.contentOffset=CGPointMake(index * self.frame.size.width, 0);
}];
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
CGFloat offsetX = scrollView.contentOffset.x / self.frame.size.width;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveFrame = _moveImageView.frame;
moveFrame.origin.x = SpaceWidth + (BtnWidth+SpaceWidth) * offsetX;
_moveImageView.frame = moveFrame;
}];
_currentBtn.enabled = YES;
UIButton *btn = (UIButton *) [self viewWithTag:offsetX + BeginTag];
btn.enabled = NO;
_currentBtn = btn;
}
@end
//
// FooterCell.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol FooterCellDelegate <NSObject>
- (void)addClick;
@end
@interface FooterCell : UIView
- (instancetype)initWithFrame:(CGRect)frame withTitle:(NSString *)title;
@property (nonatomic,strong)id<FooterCellDelegate>delegate;
@end
//
// FooterCell.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "FooterCell.h"
#define HeadWidth 70
#define TitleSize 15
#define LeftMargin 13
@interface FooterCell ()
@property (nonatomic,strong)NSString *title;
@property (nonatomic,strong)UILabel *lineLabel;
@end
@implementation FooterCell
- (instancetype)initWithFrame:(CGRect)frame withTitle:(NSString *)title{
self = [super initWithFrame:frame];
if (self) {
self.title = title;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
addBtn.frame = CGRectMake(0, 0, self.frame.size.width, 50);
[addBtn setTitle:self.title forState:UIControlStateNormal];
addBtn.backgroundColor = [UIColor whiteColor];
[addBtn setTitleColor:HexColor(@"bbbbbb") forState:UIControlStateNormal];
[addBtn addTarget:self action:@selector(addBtn) forControlEvents:UIControlEventTouchUpInside];
addBtn.titleLabel.font = FontSize(15);
[self addSubview:addBtn];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.frame.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
[self addSubview:self.lineLabel];
}
- (void)addBtn{
if ([self.delegate respondsToSelector:@selector(addClick)]) {
[self.delegate addClick];
}
}
@end
//
// HeaderCell.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HeaderCell : UIView
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
@end
//
// HeaderCell.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "HeaderCell.h"
//#define HeadWidth 70
#define TitleSize 15
#define LeftMargin 13
#define LeftWidth 50
#define SpaceMargin 1
@interface HeaderCell ()
@property (nonatomic,strong)NSArray *arr;
@property (nonatomic,strong)UILabel *lineLabel;
@end
@implementation HeaderCell
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr{
self = [super initWithFrame:frame];
if (self) {
self.arr = arr;
[self bulidLayout];
}
return self;
}
- (void)bulidLayout{
CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (self.arr.count -1))/self.arr.count;
for (NSInteger i = 0; i < self.arr.count; i++) {
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(LeftWidth + (SpaceMargin + headWidth)*i, 0, headWidth, self.frame.size.height)];
label.font = FontSize(TitleSize);
label.textAlignment = NSTextAlignmentCenter;
label.textColor = HexColor(@"bbbbbb");
label.text = self.arr[i];
[self addSubview:label];
}
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, self.frame.size.height-1, ScreenSize.width - LeftMargin * 2, 1))];
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
self.lineLabel.font = FontSize(TitleSize);
[self addSubview:self.lineLabel];
}
@end
//
// MaterialCell.h
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MaterialCell : UITableViewCell
@property (nonatomic,strong)UIImageView *smallImageView;
@property (nonatomic,strong)UIButton *editBtn;
@property (nonatomic,strong)UILabel *seqLabel;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *baseCountLabel;
@property (nonatomic,strong)UILabel *dateLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UIView *showView;
@property (nonatomic,strong)UILabel *showTitleLabel;
@property (nonatomic,strong)UILabel *showBaseCountLabel;
@property (nonatomic,strong)UILabel *showDateLabel;
@property (nonatomic,strong)UILabel *basePriceLabel;
@property (nonatomic,strong)UILabel *totalPriceLabel;
@property (nonatomic,strong)UILabel *placeLabel;
@property (nonatomic,strong)UILabel *qualityLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@end
//
// MaterialCell.m
// XFFruit
//
// Created by n22 on 15/8/19.
// Copyright (c) 2015年 Xummer. All rights reserved.
//
#import "MaterialCell.h"
#define LeftMargin 13
#define TableHeight 44
#define SmallSize 20
#define ContentColor @"444444"
#define ContentSize 16
#define SpaceMargin 1
#define LeftWidth 50
#define ShowColor @"bbbbbb"
#define ShowSize 13
#define ShowWidth 150
#define ShowHeight 20
@implementation MaterialCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
CGFloat headWidth = (ScreenSize.width - LeftWidth*2 - SpaceMargin* (3 -1))/3;
self.smallImageView = [[UIImageView alloc]initWithFrame:CGRectMake(LeftMargin, (TableHeight - SmallSize)/2 , SmallSize, SmallSize)];
self.smallImageView.image = [UIImage imageNamed:@"delete"];
self.seqLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.smallImageView.frame), 0, SmallSize, TableHeight))];
self.seqLabel.textColor = HexColor(ContentColor);
self.seqLabel.text = @"13";
self.seqLabel.font = FontSize(ContentSize);
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftWidth, 0, headWidth, TableHeight))];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = HexColor(ContentColor);
self.titleLabel.text = @"苹果桃子";
self.titleLabel.font = FontSize(ContentSize);
self.baseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.titleLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.baseCountLabel.textAlignment = NSTextAlignmentCenter;
self.baseCountLabel.textColor = HexColor(ContentColor);
self.baseCountLabel.text = @"30000";
self.baseCountLabel.font = FontSize(ContentSize);
self.dateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.baseCountLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
self.dateLabel.textAlignment = NSTextAlignmentCenter;
self.dateLabel.text = @"2015-04-05";
self.dateLabel.textColor = HexColor(ContentColor);
self.dateLabel.font = FontSize(ContentSize);
self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
self.showView.hidden = YES;
self.showTitleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin + SmallSize, 0, ShowWidth, ShowHeight))];
self.showTitleLabel.textAlignment = NSTextAlignmentLeft;
self.showTitleLabel.textColor = HexColor(ShowColor);
self.showTitleLabel.text = @"原料:苹果桃子";
self.showTitleLabel.font = FontSize(ShowSize);
self.showBaseCountLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.showTitleLabel.frame), 0, ShowWidth, ShowHeight))];
self.showBaseCountLabel.textAlignment = NSTextAlignmentLeft;
self.showBaseCountLabel.textColor = HexColor(ShowColor);
self.showBaseCountLabel.text = @"基础数量:10000";
self.showBaseCountLabel.font = FontSize(ShowSize);
self.showDateLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
self.showDateLabel.textAlignment = NSTextAlignmentLeft;
self.showDateLabel.textColor = HexColor(ShowColor);
self.showDateLabel.text = @"入库时间:2015-02-04";
self.showDateLabel.font = FontSize(ShowSize);
self.basePriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showTitleLabel.frame), ShowWidth, ShowHeight))];
self.basePriceLabel.textAlignment = NSTextAlignmentLeft;
self.basePriceLabel.textColor = HexColor(ShowColor);
self.basePriceLabel.text = @"基础单价:11元";
self.basePriceLabel.font = FontSize(ShowSize);
self.totalPriceLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
self.totalPriceLabel.textAlignment = NSTextAlignmentLeft;
self.totalPriceLabel.textColor = HexColor(ShowColor);
self.totalPriceLabel.text = @"总金额:1000";
self.totalPriceLabel.font = FontSize(ShowSize);
self.placeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showBaseCountLabel.frame), CGRectGetMaxY(self.showDateLabel.frame), ShowWidth, ShowHeight))];
self.placeLabel.textAlignment = NSTextAlignmentLeft;
self.placeLabel.textColor = HexColor(ShowColor);
self.placeLabel.text = @"产地:河南省";
self.placeLabel.font = FontSize(ShowSize);
self.qualityLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.totalPriceLabel.frame), ShowWidth, ShowHeight))];
self.qualityLabel.textAlignment = NSTextAlignmentLeft;
self.qualityLabel.textColor = HexColor(ShowColor);
self.qualityLabel.text = @"质量:1000";
self.qualityLabel.font = FontSize(ShowSize);
self.remarkLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMinX(self.showTitleLabel.frame), CGRectGetMaxY(self.qualityLabel.frame), ShowWidth, ShowHeight))];
self.remarkLabel.textAlignment = NSTextAlignmentLeft;
self.remarkLabel.textColor = HexColor(ShowColor);
self.remarkLabel.text = @"描述:河南省";
self.remarkLabel.font = FontSize(ShowSize);
self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.editBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight);
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin * 2, 1))];;
self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
[self.contentView addSubview:self.smallImageView];
[self.contentView addSubview:self.seqLabel];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.baseCountLabel];
[self.contentView addSubview:self.dateLabel];
[self.contentView addSubview:self.editBtn];
[self.contentView addSubview:self.showView];
[self.showView addSubview:self.showTitleLabel];
[self.showView addSubview:self.showBaseCountLabel];
[self.showView addSubview:self.showDateLabel];
[self.showView addSubview:self.basePriceLabel];
[self.showView addSubview:self.totalPriceLabel];
[self.showView addSubview:self.placeLabel];
[self.showView addSubview:self.qualityLabel];
[self.showView addSubview:self.remarkLabel];
[self.contentView addSubview:self.lineLabel];
}
- (void)awakeFromNib {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@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