benhowdle89
benhowdle89

Reputation: 37464

iOS SDK, Text View - make links open in-app browser

Is it possible, using Text View's "Detection" for links, to let the user open the URL in an in-app browser, as opposed to switching to Safari? If there's not a setting for that option, how can I add a handler/event for when they tap a link, to open a WebView?

Upvotes: 5

Views: 833

Answers (1)

mspensieri
mspensieri

Reputation: 3521

Try overriding textView:shouldInteractWithURL:inRange: in your UITextViewDelegate, and return NO to avoid forwarding the URL to the OS.

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
{
    // Load your webview

    return NO;
}

Upvotes: 5

Related Questions