views:

170

answers:

0

Hi i create simple web browser for my app and i don't know why when user click a link the address bar doesn't change as link address here is my code :

-(IBAction)webAddress:(id)sender {

    [site loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[webAdress text]]]];
[webAdress resignFirstResponder];

}

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
    //CAPTURE USER LINK-CLICK.
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
        NSURL *URL = [request URL]; 
        if ([[URL scheme] isEqualToString:@"http"]) {
            [webAdress setText:[URL absoluteString]];
            [self webAddress:nil];
        }    
        return NO;
    }   
    return YES;   
}