CNLiveBindingTelController.m
4.76 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
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
//
// CNLiveBindingTelController.m
// CNLiveBLoginModule
//
// Created by CNLive-zxw on 2019/9/9.
// Copyright © 2019 153993236@qq.com. All rights reserved.
//
#import "CNLiveBindingTelController.h"
#import "YYKit.h"
#import "NSAttributedString+YYText.h"
#import "QMUIKit.h"
#import "CNLiveEnvironment.h"
#import "CNLiveUserAgreementManager.h"
#import "CNLiveNavigationBar.h"
#import "CNLiveBindingTelView.h"
@interface CNLiveBindingTelController()<CNLiveBindingTelViewDelegate>
@property (nonatomic, assign) CNLiveThreeLoginType type;
@property (nonatomic, strong) CNLiveNavigationBar *navigationBar;
@property (nonatomic, strong) CNLiveBindingTelView *bindingTelView;
@property (nonatomic, strong) YYLabel *protocol;
@end
@implementation CNLiveBindingTelController
- (instancetype)initWithModel:(CNLiveThreeLoginModel *)model {
self = [super init];
if (self) {
self.model = model;
}
return self;
}
#pragma mark - 生命周期
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.automaticallyAdjustsScrollViewInsets = NO;
self.navigationController.navigationBar.translucent = NO;
self.extendedLayoutIncludesOpaqueBars = YES;
self.edgesForExtendedLayout = UIRectEdgeBottom;
self.view.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.navigationBar];
[self.view addSubview:self.bindingTelView];
[self.view addSubview:self.protocol];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.view endEditing:YES];
}
#pragma mark - CNLiveBindingTelViewDelegate
- (void)bindingSuccess:(CNLiveBindingTelView *)view type:(CNLiveThreeLoginType)type{
}
/*
#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.
}
*/
#pragma mark - 懒加载
- (CNLiveNavigationBar *)navigationBar {
if (!_navigationBar) {
_navigationBar = [CNLiveNavigationBar navigationBar];
_navigationBar.backgroundColor = [UIColor whiteColor];
_navigationBar.title.text = @"绑定手机号";
__weak typeof(self) weakSelf = self;
_navigationBar.onClickLeftButton = ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
};
_navigationBar.right = nil;
}
return _navigationBar;
}
- (CNLiveBindingTelView *)bindingTelView {
if (!_bindingTelView) {
_bindingTelView = [[CNLiveBindingTelView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/8.0, NavigationContentTop, self.view.frame.size.width*3/4.0, 400) type:self.type];
_bindingTelView.delegate = self;
}
return _bindingTelView;
}
- (YYLabel *)protocol {
if (!_protocol) {
_protocol = [[YYLabel alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height-30-NavigationContentTop-SafeAreaInsetsConstantForDeviceWithNotch.bottom, self.view.frame.size.width, 30)];
_protocol.textAlignment = NSTextAlignmentCenter;
_protocol.textColor = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
_protocol.font = [UIFont systemFontOfSize:14.0];
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"已阅读并同意《账户绑定确认书(网家家)》"];
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
style.alignment = NSTextAlignmentCenter;//对齐方式
[text addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, text.length)];
text.color = [UIColor colorWithRed:173/255.0 green:173/255.0 blue:173/255.0 alpha:1.0];
text.font = [UIFont systemFontOfSize:14.0];
__weak typeof(self) weakSelf = self;
UIColor *color = BusinessLive?[UIColor colorWithRed:72/255.0 green:168/255.0 blue:249/255.0 alpha:1.0]:[UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
[text setTextHighlightRange:NSMakeRange(7, 12) color:color backgroundColor:[UIColor clearColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if(!strongSelf) return;
[strongSelf.view endEditing:YES];
[CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementUser];
}];
_protocol.attributedText = text;
}
return _protocol;
}
@end