0

I've got a viewController with an TextView where feed are loaded in and when there's a link in it and you tab on it a webview should load up with the link. So I've created a webview, but how should the if statement that says: "if there's a url load the webviewcontroller with this url" look?

In the WebViewController I've got:

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]]];

Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
Leon
  • 417
  • 3
  • 11
  • 24
  • Could you clarify your question? Are you asking how to parse the text in your rss feeds and detect the URLs? – Johannes Fahrenkrug Jan 27 '11 at 19:53
  • What you have is correct if you're just loading a URL. If the URL is the text of your textView, then: [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[myTextView text]]]]; Is that what you're asking? – kevboh Jan 27 '11 at 19:54
  • i want to detect the url from the textview. the text view is for example: blablabala http://www.google.de bla bla. Now I want to detect the url and give it to the webviewcontroller where the webview should load this url – Leon Jan 27 '11 at 20:08

1 Answers1

0

Here are some resources that should get you going:

http://www.cocoabuilder.com/archive/cocoa/129873-detect-url-in-nstextview.html (this is for Mac OS, but might be helpful nonetheless)

For iPhone: iPhone's UILabel with URL detection

And: How to make UITextView detect links for website, mail and phone number

Enjoy!

Community
  • 1
  • 1
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165