I Am getting a string from API which is "http://www.maximusautogroup.com/\" target=\"_blank\">here". From this string I have to show "here" as an hyperlink of that link. i am not getting how to do that.
3
-
are you using textfield for display this link or label .@Aditya PandeyVinod Kumar– Vinod Kumar2017-05-25 04:42:11 +00:00Commented May 25, 2017 at 4:42
-
you can try stackoverflow.com/a/21630187/4970453. and. stackoverflow.com/a/19228078/4970453Varinder Singh iPhone Dev– Varinder Singh iPhone Dev2017-05-25 04:49:23 +00:00Commented May 25, 2017 at 4:49
-
I am using textview .... and the complete string I am getting is "Our official working hours are 9 am to 6 pm ET. We will get back to you on next working day. Please visit <a href=\"maximusautogroup.com\" target=\"_blank\">here</a> to know about our claim pr";Aditya Pandey– Aditya Pandey2017-05-25 04:50:32 +00:00Commented May 25, 2017 at 4:50
Add a comment
|
1 Answer
Try this:
NSString *FileName = [[Url lastPathComponent] stringByDeletingPathExtension];
NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:FileName];
[attributeString addAttributes:@{NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)
, NSBackgroundColorAttributeName: [UIColor blueColor]} range:NSMakeRange(0, [attributeString length])]
[_buyButton setAttributedTitle:attributeString forState:UIControlStateNormal];