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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//
// AddressViewController.m
// Lighting
//
// Created by 曹云霄 on 16/5/10.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "AddressViewController.h"
#import "ModifyShippingAddressView.h"
@interface AddressViewController ()<CityselectedDelegate>
/**
* 城市选择器
*/
@property (nonatomic,strong) ModifyShippingAddressView *citySelecteview;
@end
@implementation AddressViewController
/**
* 城市选择View
*
* @return ModifyShippingAddressView
*/
- (ModifyShippingAddressView *)citySelecteview
{
if (_citySelecteview == nil) {
_citySelecteview = [[[NSBundle mainBundle] loadNibNamed:@"ModifyShippingAddressView"
owner:self options:nil] lastObject];
}
return _citySelecteview;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[self uiConfigAction];
}
#pragma mark -布局
- (void)uiConfigAction
{
self.recipientUserBackview.layer.masksToBounds = YES;
self.recipientUserBackview.layer.cornerRadius = kCornerRadius;
self.phoneNumberBackview.layer.masksToBounds = YES;
self.phoneNumberBackview.layer.cornerRadius = kCornerRadius;
self.detailsAddressBackview.layer.masksToBounds = YES;
self.detailsAddressBackview.layer.cornerRadius = kCornerRadius;
self.citySelected.layer.masksToBounds = YES;
self.citySelected.layer.cornerRadius = kCornerRadius;
[self.citySelected addTarget:self action:@selector(SelectedCityButtonClick) forControlEvents:UIControlEventTouchUpInside];
}
#pragma mark -取消弹出的圆角
- (void)viewWillAppear:(BOOL)animated
{
self.view.superview.layer.cornerRadius = 0;
}
#pragma mark -城市选择器
- (void)SelectedCityButtonClick
{
self.citySelecteview.frame = CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, 160);
[self.view addSubview:self.citySelecteview];
self.citySelecteview.delegate = self;
[self.citySelecteview.selectedCityButton addTarget:self action:@selector(CompleteButton) forControlEvents:UIControlEventTouchUpInside];
[UIView animateWithDuration:0.2 animations:^{
self.citySelecteview.frame = CGRectMake(0, self.view.frame.size.height-160, self.view.frame.size.width, 160);
}completion:^(BOOL finished) {
self.citySelected.enabled = NO;
}];
}
#pragma mark -完成按钮点击
- (void)CompleteButton
{
[UIView animateWithDuration:0.2 animations:^{
self.citySelecteview.frame = CGRectMake(0, ScreenHeight, self.view.frame.size.width, 160);
}completion:^(BOOL finished) {
[self.citySelecteview removeFromSuperview];
self.citySelecteview = nil;
self.citySelected.enabled = YES;
}];
}
#pragma mark -关闭地址输入框
- (IBAction)turnoffAddressView:(UIButton *)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark 完成城市选择后
- (void)citySelected:(NSString *)cityString
{
[self.citySelected setTitle:cityString forState:UIControlStateNormal];
}
#pragma mark 新增按钮点击,或者修改
- (IBAction)addAddressButtonClick:(UIButton *)sender {
[self addAddressInformationRequest];
}
#pragma mark -新增地址信息
- (void)addAddressInformationRequest
{
TOShippingAddrEntity *address = [[TOShippingAddrEntity alloc]init];
address.consumerId = [Customermanager manager].customerID;
address.name = self.recipientPerson.text;
address.miblephone = self.PhoneNumber.text;
address.city = [self.citySelected currentTitle];
address.address = self.detailsAddress.text;
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/shippingAddress/save"] WithRequestType:0 WithParameter:address WithReturnValueBlock:^(id returnValue) {
NSLog(@"%@",returnValue);
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(id error) {
NSLog(@"%@",error);
}];
}
//@synthesize fid;
//@synthesize createDate;
//@synthesize sysOrgCode;
//@synthesize name;
//@synthesize miblephone;
//@synthesize province;
//@synthesize city;
//@synthesize country;
//@synthesize address;
//@synthesize state;
//@synthesize consumerId;
#pragma mark -修改收货地址
- (void)ChangeAddressRequest
{
TOShippingAddrEntity *change = [[TOShippingAddrEntity alloc]init];
}
#pragma mark -取消新增地址,或者删除
- (IBAction)cancelButtonClick:(UIButton *)sender {
}
/*
#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