EmailViewController.m
3.25 KB
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
//
// EmailViewController.m
// CNLiveUserSystemDemo
//
// Created by 张旭 on 2017/5/27.
// Copyright © 2017年 zhulin. All rights reserved.
//
#import "EmailViewController.h"
@interface EmailViewController ()
@property (nonatomic ,strong) UITextField * _Nullable emailTF;
@property (nonatomic ,strong) UITextField * _Nullable pwdTF;
@property (nonatomic, strong) UIButton * _Nullable confirmBtn;
@end
@implementation EmailViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.emailTF];
[self.view addSubview:self.pwdTF];
[self.view addSubview:self.confirmBtn];
}
- (void)confirmBtnAction
{
[CNLiveUserSystemCenter modifyPwdWithEmail:self.emailTF.text newPwd:self.pwdTF.text success:^(id result) {
NSLog(@"result: %@",result);
[Tools toast:result[@"errorMessage"]];
} failure:^(NSDictionary *errorDic) {
[Tools toast:[NSString stringWithFormat:@"errorCode : %@ \n errorMessage : %@", errorDic[@"errorCode"],errorDic[@"errorMessage"]]];
}];
}
- (UIButton *)confirmBtn
{
if (!_confirmBtn) {
_confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_confirmBtn setFrame:CGRectMake(10, 280, KScreenWidth - 20, 40)];
[_confirmBtn setTitle:@"确 认" forState:UIControlStateNormal];
[_confirmBtn addTarget:self action:@selector(confirmBtnAction) forControlEvents:UIControlEventTouchUpInside];
_confirmBtn.titleLabel.font = [UIFont systemFontOfSize:18];
[_confirmBtn setTitleColor:[UIColor colorWithRed:23/255.0 green:110/255.0 blue:254/255.0 alpha:1] forState:UIControlStateNormal];
_confirmBtn.layer.cornerRadius = 20;
_confirmBtn.layer.masksToBounds = YES;
_confirmBtn.layer.borderColor = [UIColor blackColor].CGColor;
_confirmBtn.layer.borderWidth = 1;
}
return _confirmBtn;
}
- (UITextField *)emailTF
{
if (!_emailTF) {
_emailTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70, KScreenWidth - 20, 57)];
_emailTF.placeholder = @"请输入您的邮箱";
_emailTF.keyboardType = UIKeyboardTypeNamePhonePad;
_emailTF.clearButtonMode = UITextFieldViewModeWhileEditing;
_emailTF.font = [UIFont systemFontOfSize:17];
}
return _emailTF;
}
- (UITextField *)pwdTF
{
if (!_pwdTF) {
_pwdTF = [[UITextField alloc] initWithFrame:CGRectMake(10, 70 + 57, KScreenWidth - 20, 57)];
_pwdTF.placeholder = @"请输入您的新密码";
_pwdTF.clearButtonMode = UITextFieldViewModeWhileEditing;
_pwdTF.keyboardType = UIKeyboardTypeNamePhonePad;
_pwdTF.font = [UIFont systemFontOfSize:17];
}
return _pwdTF;
}
- (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