views:

135

answers:

1

I am using UIWebView as a web browser on my application and when I open an url with my browser and return back to the main view, then go to browser view, my webview doesn't save the content. So, if I go to google.com and switch views, then again go to the browser view, I have to type the url again to open the webpage! How can I save the web browser's content?

+1  A: 
  • (void)viewDidUnload method of UIWebView save the url in AppDelagate's variable(NSString say for example NSString *lastURL) and in ViewDidLoad of UIwebView check for that variable(lastURL) if it contains some value than load the webview with that URL... Simple...
mihirpmehta
thank you but iam amateur iphone programming can you help me more ?
Momeks
from this answer what exactly is not understood by you... ?
mihirpmehta
to creat lastURL and store the web view link on it
Momeks
In your UIWebView's Class there should be one method viewDidUnload inside that assign UIWebView's current URl to lastURL... inside ViewWillAppear method check lastURL if it contains some value than load your webview with lastURL... (initally lastURL would be nil)
mihirpmehta