I have am reading a twitter feed in my iPhone application and can do it correctly, but I'd like to evolve开发者_开发知识库 it in a way to detect if the whole NSString contains any URL or URLs and create a "link" that will open a UIWebView within the same application.
Can you guide me on how to perform this task?
-(void) setTextTwitter:(NSString *)text WithDate:(NSString*)date
{
[text retain];
[textTwitter release], textTwitter = nil;
textTwitter = text;
[date retain];
[dateTwitter release], dateTwitter = nil;
dateTwitter = date;
[self setNeedsDisplay];
}
Check out Craig Hockenberry's IFTweetLabel, which can be found here.
Or you can use the label provided by Three20 library, which can be found here.
Or the simplest solution: use UIWebView with dataDetectorTypes set to UIDataDetectorTypeLink.
Cheers, Paul
精彩评论