I am making a app and part of it needs to display an image. Instead of have the app download the image, I want to just show it in a UIWebView. I have added the WebView to the app and given it the URL to the image and told it to load, however it stays as a white screen. I even tried to get it to load http://www.google.com and it still wouldn’t load.
Can anyone help me with this? Here is how everything I’m doing to the web view.
-(void)viewDidLoad
{
NSURL *url = [NSURL URLWithString:@"www.google.com"];
NSURLRequest *requent = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
The webView is declared as follows in the .h file:
IBOUTlet UIWebView *webView;
@property (nonatomic, retain) UIWebView *webView;
And it is synthesised in the .m file.
Just replace
www.google.comwithhttp://www.google.comand it will work.Please also add UIWebView as IBOutlet –
please connect web view in your story board –