JGJLinkLabel
向标签添加链接文本并使其可点击(多行文本也受支持。)
支持 Cocoapods。
pod 'JGJLinkLabel'
使用
JGJLinkLabel *linkLabel = [[JGJLinkLabel alloc] init];
[self.view addSubview:linkLabel];
linkLabel.numberOfLines = 0;
linkLabel.linkColor = [UIColor redColor];
linkLabel.text = @"By tapping ‘Register’, you have read and agree to the Terms of Use and Privacy Policy";
[linkLabel addLinkText:@"Terms of Use" clickHandler:^{
NSLog(@"Clicked Terms of Use.");
}];
[linkLabel addLinkText:@"Privacy Policy" clickHandler:nil];
[linkLabel setClickLinkGlobalHandler:^(NSString *linkText) {
NSLog(@"Clicked %@", linkText);
}];
截图
待办事项列表
- 添加 Swift 版本。
- 为多个匹配项应用链接文本。(当前版本仅应用于第一个匹配项。)