Hey, I've got a UIWebView in IB that's hooked up to an outlet in my code called web and it's delegate is set to First Owner, I have this code:
After I put in google.com in my address bar and click go I see the text in the console:
I know why, because http:// isn't in front of it, but that's the point of the code above.
I have added <UIWebViewDelegate> to my header file:
Any idea's why that code isn't working?
EDIT: I think I had the wrong idea of this code, it will only run if the URL passed is valid, so I'm adding the HTTP:// etc... before I send the URL I want it to load.
Code:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"1");
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *URL = [request URL];
if ([[URL scheme] isEqualToString:@"http"]){
[navigationBar setText:[URL absoluteString]];
}
return NO;
}
return YES;
}
Code:
Unknown scheme, doing nothing: google.com
I have added <UIWebViewDelegate> to my header file:
Code:
@interface MyController : UIViewController <UIWebViewDelegate>
Any idea's why that code isn't working?
EDIT: I think I had the wrong idea of this code, it will only run if the URL passed is valid, so I'm adding the HTTP:// etc... before I send the URL I want it to load.