tounaobun / JGJLinkLabel

Add link text to label and make it clickable^_^ [Especially useful for Terms of Use & Privacy Policy]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JGJLinkLabel

Add link text to label and make it clickable (multiple lines are also supported.)

Support Cocoapods.

pod 'JGJLinkLabel'

Usage:

    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);
    }];

Screenshot:

alt text

Todo list:

  1. Add Swift version.
  2. link text applied for multiple matches.(Current version only applied to the first matched.)

About

Add link text to label and make it clickable^_^ [Especially useful for Terms of Use & Privacy Policy]

License:MIT License


Languages

Language:Objective-C 92.1%Language:Ruby 7.9%