I have an app with a TableView
. TableViewCell
contains a UILabel
, which can contain URLs. I want these URL to open in a WebView
.
Right now I'm opening Safari when user taps a link ( I'm using KILabel
).
What I want to do is to open these links in my app, by creating a new ViewController
that contains UIWebView
.
I'm wondering what is the best way to achieve it? Is it better to use storyboards or not? Do I need to create storyboard programmatically or from InterfaceBuilder?
There are many ways to solve this problem. Here is one solution using NSUS
let defaults = NSUserDefaults.standardUserDefaults() defaults.setObject("http://www.ThisIsTheLinkThatWasClicked", forKey: "currentActiveURLKey")
4.now you can access thus URL from any view AND when the app is closed and reopened, the data is saved
let defaults = NSUserDefaults.standardUserDefaults() if let url = defaults.stringForKey("currentActiveURLKey") { println(url) }