Reputation: 45
I have a method that loads the content in my WebView:
-(void)loadContent:(NSURLRequest *)requestObj{
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
webView.delegate = self;
NSLog(@"LOAD WEBSITE!!!");
}
when I first call it like this:
[self loadContent:requestObj];
it works fine! But when I call it again for a new URL, it does not work.
I have readed that it will help to call the following before loading the new URL:
[webView stringByEvaluatingJavaScriptFromString:@"document.open();document.close()"];
But it doesn't change the result. Does anyone know how to handle this? Please be patient with me, I'm new in the iOS-world.
Ok i find out, my WebView is Null, but why? I call it from the ViewController and it has to be there. Does someone know how to handle this?
UPDATE: It is not Null any more cause i do this:
if(!webView)
{
webView = [[UIWebView alloc]init];
}
But it does not change the content when i do this: [webView loadRequest:requestObj];
Upvotes: 2
Views: 1035
Reputation: 370
http://sweng.epfl.ch/tutorials/getting-started-with-ios-developement-xcode-and-objective-c
you can go through the above link and find a step by step procedure
http://www.raywenderlich.com/2712/using-properties-in-objective-c-tutorial
you can download a sample code from the above link.
Upvotes: 0