2
This commit is contained in:
@@ -6,26 +6,169 @@
|
||||
//
|
||||
|
||||
#import "KBRegistVerEmailVC.h"
|
||||
#import "CRBoxInputView.h"
|
||||
|
||||
@interface KBRegistVerEmailVC ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // Verify Email
|
||||
@property (nonatomic, strong) UILabel *subTitleLabel; // Enter Email Verification Code
|
||||
@property (nonatomic, strong) CRBoxInputView *codeInputView;
|
||||
@property (nonatomic, strong) UILabel *descLabel; // 多行提示文案
|
||||
@property (nonatomic, strong) UIButton *confirmButton; // Confirm
|
||||
|
||||
@end
|
||||
|
||||
@implementation KBRegistVerEmailVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
self.kb_titleLabel.text = KBLocalized(@"Verify Email");
|
||||
|
||||
[self setupUI];
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
#pragma mark - UI
|
||||
|
||||
// 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.
|
||||
- (void)setupUI {
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.view addSubview:self.subTitleLabel];
|
||||
[self.view addSubview:self.codeInputView];
|
||||
[self.view addSubview:self.descLabel];
|
||||
[self.view addSubview:self.confirmButton];
|
||||
|
||||
// 标题
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT + 32);
|
||||
}];
|
||||
|
||||
// 副标题
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
|
||||
}];
|
||||
|
||||
// 验证码输入
|
||||
[self.codeInputView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.subTitleLabel.mas_bottom).offset(24);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
|
||||
// 描述文案
|
||||
[self.descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.codeInputView.mas_bottom).offset(24);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
}];
|
||||
|
||||
// Confirm 按钮
|
||||
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.descLabel.mas_bottom).offset(32);
|
||||
make.left.equalTo(self.view).offset(24);
|
||||
make.right.equalTo(self.view).offset(-24);
|
||||
make.height.mas_equalTo(56);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onTapConfirm {
|
||||
NSString *code = self.codeInputView.textValue ?: @"";
|
||||
if (code.length == 0) {
|
||||
[KBHUD showInfo:KBLocalized(@"Enter Email Verification Code")];
|
||||
return;
|
||||
}
|
||||
KBLOG(@"KBRegistVerEmailVC confirm with code=%@", code);
|
||||
// TODO: 注册流程中验证邮箱验证码的逻辑
|
||||
}
|
||||
|
||||
#pragma mark - Lazy UI
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [UILabel new];
|
||||
_titleLabel.text = KBLocalized(@"Verify Email");
|
||||
_titleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_titleLabel.font = [KBFont bold:20];
|
||||
_titleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)subTitleLabel {
|
||||
if (!_subTitleLabel) {
|
||||
_subTitleLabel = [UILabel new];
|
||||
_subTitleLabel.text = KBLocalized(@"Enter Email Verification Code");
|
||||
_subTitleLabel.textColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_subTitleLabel.font = [KBFont regular:14];
|
||||
_subTitleLabel.textAlignment = NSTextAlignmentLeft;
|
||||
}
|
||||
return _subTitleLabel;
|
||||
}
|
||||
|
||||
- (CRBoxInputView *)codeInputView {
|
||||
if (!_codeInputView) {
|
||||
_codeInputView = [[CRBoxInputView alloc] initWithCodeLength:6];
|
||||
_codeInputView.backgroundColor = [UIColor clearColor];
|
||||
_codeInputView.ifNeedCursor = YES;
|
||||
_codeInputView.keyBoardType = UIKeyboardTypeNumberPad;
|
||||
_codeInputView.inputType = CRInputType_Number;
|
||||
|
||||
// CRBoxFlowLayout *layout = [[CRBoxFlowLayout alloc] init];
|
||||
// layout.itemSize = CGSizeMake(40, 48);
|
||||
// layout.minimumInteritemSpacing = 12;
|
||||
// layout.minimumLineSpacing = 12;
|
||||
// layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
// _codeInputView.boxFlowLayout = layout;
|
||||
|
||||
CRBoxInputCellProperty *prop = [[CRBoxInputCellProperty alloc] init];
|
||||
prop.borderWidth = 0;
|
||||
prop.cornerRadius = 8.0;
|
||||
prop.cellBgColorNormal = [UIColor colorWithHex:0xF7F7F7];
|
||||
prop.cellBgColorSelected = [UIColor colorWithHex:0xE0F5F2];
|
||||
prop.cellCursorColor = [UIColor colorWithHex:KBBlackValue];
|
||||
prop.cellFont = [KBFont bold:20];
|
||||
prop.cellTextColor = [UIColor colorWithHex:KBBlackValue];
|
||||
_codeInputView.customCellProperty = prop;
|
||||
|
||||
[_codeInputView loadAndPrepareView];
|
||||
}
|
||||
return _codeInputView;
|
||||
}
|
||||
|
||||
- (UILabel *)descLabel {
|
||||
if (!_descLabel) {
|
||||
_descLabel = [UILabel new];
|
||||
_descLabel.textColor = [UIColor colorWithHex:0x717171];
|
||||
_descLabel.font = [KBFont regular:12];
|
||||
_descLabel.numberOfLines = 0;
|
||||
_descLabel.textAlignment = NSTextAlignmentLeft;
|
||||
|
||||
// 这里用 %@ 预留邮箱地址占位
|
||||
NSString *template = KBLocalized(@"We have already sent it to the email address %@. Please enter the 6-digit verification code from the email to verify your mailbox.");
|
||||
// 默认先用一个占位邮箱,外部可以根据真实邮箱重新设置
|
||||
NSString *email = @"example@mail.com";
|
||||
_descLabel.text = [NSString stringWithFormat:template, email];
|
||||
}
|
||||
return _descLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)confirmButton {
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmButton setTitle:KBLocalized(@"Confirm") forState:UIControlStateNormal];
|
||||
[_confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_confirmButton.titleLabel.font = [KBFont medium:16];
|
||||
_confirmButton.backgroundColor = [UIColor colorWithHex:KBColorValue];
|
||||
_confirmButton.layer.cornerRadius = 28.0;
|
||||
_confirmButton.layer.masksToBounds = YES;
|
||||
[_confirmButton addTarget:self action:@selector(onTapConfirm)
|
||||
forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _confirmButton;
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user