Initial commit
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// GiGaRegistViewController.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/8/21.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaRegistViewController.h"
|
||||
#import "TTTAttributedLabel.h"
|
||||
#import "GiGaWebViewController.h"
|
||||
@interface GiGaRegistViewController ()<TTTAttributedLabelDelegate>
|
||||
@property (weak, nonatomic) IBOutlet UITextField *phoneNumberTextField;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *codeTextField;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *sendCodeBtn;
|
||||
@property (weak, nonatomic) IBOutlet UITextField *passTexFied;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *checkBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *registBtn;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet TTTAttributedLabel *useragreementLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GiGaRegistViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.title = @"注册";
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
[self confirmUI];
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)confirmUI{
|
||||
|
||||
self.useragreementLabel.highlightedTextColor = [UIColor lightGrayColor];
|
||||
self.useragreementLabel.delegate = self;
|
||||
self.useragreementLabel.enabledTextCheckingTypes= NSTextCheckingTypePhoneNumber|NSTextCheckingTypeAddress|NSTextCheckingTypeLink;
|
||||
self.useragreementLabel.linkAttributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:(NSString *)kCTUnderlineStyleAttributeName];
|
||||
|
||||
//链接正常状态文本属性NSTextCheckingTypeLink;
|
||||
NSString *text = @"已阅读并同意《用户服务协议》";
|
||||
[self.useragreementLabel setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:^NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
|
||||
|
||||
NSRange fontRange = [[mutableAttributedString string] rangeOfString:@"用户服务协议" options:NSCaseInsensitiveSearch];
|
||||
UIFont* sysFont = [UIFont systemFontOfSize:15];
|
||||
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];
|
||||
}
|
||||
|
||||
return mutableAttributedString;
|
||||
|
||||
}];
|
||||
NSRange fontRange = [text rangeOfString:@"用户服务协议" options:NSCaseInsensitiveSearch];
|
||||
|
||||
[self.useragreementLabel addLinkToTransitInformation:@{
|
||||
@"SourceName":@"useragreement"
|
||||
} withRange:fontRange];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - TTTAttributedLabelDelegate
|
||||
-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
-(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithTransitInformation:(NSDictionary *)components
|
||||
{
|
||||
NSLog(@"components%@",components);
|
||||
// GiGaWebViewController *webView = [[GiGaWebViewController alloc] init];
|
||||
// webView.souceType = WebSourceTypeLoacalHtml;
|
||||
// webView.fileName = components[@"SourceName"];
|
||||
// [self.navigationController pushViewController:webView animated:YES];
|
||||
GiGaWebViewController *webView = [[GiGaWebViewController alloc] init];
|
||||
webView.souceType = WebSourceTypeUrlLink;
|
||||
webView.url = @"http://www.youtansu.com";
|
||||
[self.navigationController pushViewController:webView animated:YES];
|
||||
}
|
||||
|
||||
- (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
|
||||
Reference in New Issue
Block a user