add files

This commit is contained in:
lianxiang
2018-08-31 18:23:25 +08:00
parent 3efde8e0ea
commit e64e011d8f
26 changed files with 496 additions and 256 deletions
@@ -33,13 +33,15 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"注册";
_time = 60;
//self.title = @"注册";
[self addNavTitile:@"注册"];
_time = 60;
// Do any additional setup after loading the view from its nib.
[self confirmUI];
[self.sendCodeBtn addTarget:self action:@selector(sendCodeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.registBtn addTarget:self action:@selector(registBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.checkBtn addTarget:self action:@selector(checkBtnAction:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)dealloc{
@@ -50,6 +52,7 @@
}
}
-(void)sendCodeBtnAction:(UIButton *)btn{
if (self.phoneNumberTextField.text == nil) {
@@ -74,7 +77,7 @@
if (self->_time==0) {
[self.sendCodeBtn setTitle:@"发送短信" forState:UIControlStateNormal];
[btn setBackgroundColor:GIGAUIColorFromRGBA(0x28b9ff)];
self->_time =60;
btn.userInteractionEnabled = YES;
}
@@ -106,6 +109,7 @@
-(void)confirmUI{
self.useragreementLabel.highlightedTextColor = [UIColor lightGrayColor];
self.useragreementLabel.textColor = GIGAUIColorFromRGBA(0x919191);
self.useragreementLabel.delegate = self;
self.useragreementLabel.enabledTextCheckingTypes= NSTextCheckingTypePhoneNumber|NSTextCheckingTypeAddress|NSTextCheckingTypeLink;
self.useragreementLabel.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCTUnderlineStyleAttributeName];
@@ -114,13 +118,13 @@
NSString *text = @"已阅读并同意《用户服务协议》";
[self.useragreementLabel setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
NSRange fontRange = [[mutableAttributedString string] rangeOfString:@"用户服务协议" options:NSCaseInsensitiveSearch];
UIFont* sysFont = [UIFont systemFontOfSize:15];
UIFont* sysFont = [UIFont fontWithName:@"PingFangSC-Semibold" size:10.f];
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)sysFont.fontName, sysFont.pointSize, NULL);
if (font) {
[mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:fontRange];
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(__bridge id)[[UIColor greenColor] CGColor] range:fontRange];
[mutableAttributedString addAttribute:(NSString *)kCTForegroundColorAttributeName value:(__bridge id)[[UIColor colorWithRed:0/255.0 green:222/255.0 blue:189/255.0 alpha:1/1.0] CGColor] range:fontRange];
}
return mutableAttributedString;
@@ -131,6 +135,9 @@
@"SourceName":@"useragreement"
} withRange:fontRange];
self.registBtn.layer.masksToBounds = YES;
self.registBtn.layer.cornerRadius = self.registBtn.frame.size.height / 2;
}
#pragma mark - TTTAttributedLabelDelegate
@@ -188,10 +195,8 @@
btn.userInteractionEnabled = YES;
GILog(@"注册->%@",result.message);
if (result.code == 0) {
NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text);
NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text);
}else if (result.code == GiGAErrorCode_USER_EXIST){
GIGA_ShowToast(@"用户已存在");
NC_POST_NAME_OBJECT(kUserRegistSucccess,self.phoneNumberTextField.text);
@@ -203,6 +208,21 @@
}
-(void)checkBtnAction:(UIButton *)btn{
btn.selected = !btn.selected;
if (btn.selected) {
[btn setImage:[UIImage imageNamed:@"btn_turndown"] forState:UIControlStateSelected];
[self.registBtn setBackgroundColor:[UIColor lightGrayColor]];
self.registBtn.userInteractionEnabled = NO;
}else{
[btn setImage:[UIImage imageNamed:@"btn_right"] forState:UIControlStateNormal];
[self.registBtn setBackgroundColor:GIGARGB(0, 222, 189, 1)];
self.registBtn.userInteractionEnabled = YES;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.