I am developing a social app in which I need show post and sharing etc. I also need to show tag friend.
When post is show on list UI is also similar to Facebook post. Please check below screen shot.
As you can see Clicking Post title is as attributed single line, Where I need to open User Profile when user click on his name that is Person Name Abc and want to open Page when user click on Buzzfeed india,
As we need to use a UILabel to display content like this I am not able to get click on particular word. I have already tried https://github.com/null09264/FRHyperLabel but when there is multiple line Then clicking on word is not perfect.
You can use TTTAttributedLabel to make a particular part or words tappable in a UILabel.
For example
label.text = @"Fork me on GitHub!"; // Repository URL will be automatically detected and linked
NSRange range = [label.text rangeOfString:@"me"];
[label addLinkToURL:[NSURL URLWithString:@"meUrl"] withRange:range];
Here me becomes tappable and on tapping that word delegate method didSelectLinkWithURL gets called and you can check for that link inside that function
(void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
NSLog(@"link %@", [url absoluteString]);
if ([url absoluteString] == @"meUrl") {
//implement your logic here
}
NSLog(@"whole label %@", label);
}