1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//
// ClientdetailsViewController.m
// Lighting
//
// Created by 曹云霄 on 16/5/3.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "ClientdetailsViewController.h"
#import "ClientDetailsTableViewCell.h"
#import "OrderTableViewCell.h"
#import "OrderdetailsViewController.h"
@interface ClientdetailsViewController ()<UITableViewDelegate,UITableViewDataSource>
/**
* 客户详情
*/
@property (weak, nonatomic) IBOutlet UITableView *ClientdetailsTableview;
@end
@implementation ClientdetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self uiConfigAction];
}
#pragma mark -UI
- (void)uiConfigAction
{
self.ClientdetailsTableview.delegate = self;
self.ClientdetailsTableview.dataSource = self;
//圆角
self.shoppingAndRecordBackview.layer.masksToBounds = YES;
self.shoppingAndRecordBackview.layer.cornerRadius = kCornerRadius;
self.shoppingBagButton.layer.masksToBounds = YES;
self.shoppingBagButton.layer.cornerRadius = kCornerRadius;
self.orderRecordButton.layer.masksToBounds = YES;
self.orderRecordButton.layer.cornerRadius = kCornerRadius;
//默认选中购物袋
self.shoppingBagButton.selected = YES;
self.shoppingBagButton.backgroundColor = [UIColor whiteColor];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.shoppingBagButton.selected) {
ClientDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ClientDetails" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (self.orderRecordButton.selected)
{
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ordercell" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
return nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 20;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (self.shoppingBagButton.selected) {
return 100;
}
else if (self.orderRecordButton.selected)
{
return 200;
}
return 0;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
OrderdetailsViewController *orderdetails = [storyboard instantiateViewControllerWithIdentifier:@"orderdetails"];
[self.navigationController pushViewController:orderdetails animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark -设为当前的客户
- (IBAction)SetupcurrentUserButtonClick:(UIButton *)sender {
}
#pragma mark -购物袋
- (IBAction)ShoppingbagButtonClick:(UIButton *)sender {
sender.backgroundColor = [UIColor whiteColor];
sender.selected = YES;
self.orderRecordButton.selected = NO;
self.orderRecordButton.backgroundColor = kMainBlueColor;
[self.ClientdetailsTableview reloadData];
}
#pragma mark -订单记录
- (IBAction)OrderrecordButtonClick:(UIButton *)sender {
sender.backgroundColor = [UIColor whiteColor];
sender.selected = YES;
self.shoppingBagButton.selected = NO;
self.shoppingBagButton.backgroundColor = kMainBlueColor;
[self.ClientdetailsTableview reloadData];
}
/*
#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