I want to show hyperlink with text by using Attributed string in UILabel
.
I have search for that but not getting any proper result.
Is it possible to show text with hyperlink using attributed string in UILabel
?
Can anyone guide me please ?
I want to show hyperlink with text by using Attributed string in UILabel
.
I have search for that but not getting any proper result.
Is it possible to show text with hyperlink using attributed string in UILabel
?
Can anyone guide me please ?
Take a look at DTCoreText Import their library into your project. And then:
Import these classes in your ViewController
#import <NSAttributedString+HTML.h>
#import <DTCoreText/DTCoreTextConstants.h>
And do something like:
NSData *HTMLData = [htmlString dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *optionsDictionary = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], DTUseiOS6Attributes, @"your-fontName" , DTDefaultFontFamily, @(12), DTDefaultFontSize, nil];
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithHTMLData:HTMLData options:optionsDictionary documentAttributes:nil];
[infoBodyLabel setAttributedText:attrString];
And you're done!