Hi want to highlight a substring from a string. I'm doing an app for Twitter and I want to highlight the usernames and hashtags and urls.I have the string and the substring captured.All I want is to highlight that substring from the string.
Edit: The problem is that I don't know how to get the range from that string,because I get that string over Twitter and I don't know it.Help me to get the range
for user in tweet.userMentions{
let userName:NSString = user.keyword
var atrString = NSMutableAttributedString(string:tweetTextLabel.text!)
atrString.addAttribute(NSForegroundColorAttributeName, value: UIColor.redColor(), range: //myproblem is here)
tweetTextLabel.text = atrString
}
}