I’m trying to use a UIWebView for the first time but I can’t seem to make it load a page. The screen just remains blank.
I have a UIWebView in my storyboard. My controller.h:
@interface fishcoViewController : UIViewController{
IBOutlet UIWebView *webView;
}
My controller.m
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:@"http:/www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
}
Shouldn’t the code in controller.m run when the view loads, which should make the webpage load? Instead I’m just seeing a blank page.
You forgot –
[self.webView loadRequest:request];This is what actually loads your url into the webView & it starts fetching from the net.