iPhone SDK : UIWebView detect link on textfeild !

Posted by Momeks on Stack Overflow See other posts from Stack Overflow or by Momeks
Published on 2010-05-15T14:29:47Z Indexed on 2010/05/15 14:34 UTC
Read the original article Hit count: 716

Filed under:
|
|

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;   
}

what's my problem ?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about SDK