Detect if NSString contains a URL and generate a "link" to open inside the app a Safari View

Posted by Cy on Stack Overflow See other posts from Stack Overflow or by Cy
Published on 2010-05-17T10:23:04Z Indexed on 2010/05/17 10:40 UTC
Read the original article Hit count: 191

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];
}

© Stack Overflow or respective owner

Related posts about uiwebview

Related posts about objective-c