Skip to content

HyperLinks not working #29

@rahulbbit

Description

@rahulbbit
 FRHyperLabel *label = self.lblTermsAndPrivacyPolicy;
    label.numberOfLines = 0;
    NSString *string = @"By continuing you indicate that you have read and agree to the Terms Of Service and Privacy Policy";
    
    NSMutableParagraphStyle *style  = [[NSMutableParagraphStyle alloc] init];
    style.alignment= NSTextAlignmentCenter;
    
    NSDictionary *attributes ;
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
        attributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:20],NSParagraphStyleAttributeName:style};
    }
    else
    {
        attributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],NSFontAttributeName:font13,NSParagraphStyleAttributeName:style,NSUnderlineStyleAttributeName:[NSNumber numberWithInt:NSUnderlineStyleNone]};
    }
    
    label.attributedText = [[NSAttributedString alloc]initWithString:string attributes:attributes];

//    [label setLinkAttributeDefault:attributes];
    
    //Step 2: Define a selection handler block
    void(^handler)(FRHyperLabel *label, NSString *substring) = ^(FRHyperLabel *label, NSString *substring){
        NSLog(@"%@",substring);
    };
    
    //Step 3: Add link substrings
    [label setLinksForSubstrings:@[@"Privacy Policy",@"Terms Of Service"] withLinkHandler:handler];

screen shot 2017-08-23 at 12 15 48 pm 1

i have written this code, still not working

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions