link a web page in application.

Discussion in 'iOS Programming' started by forrestxu, Aug 14, 2008.

  1. forrestxu macrumors newbie

    Joined:
    May 31, 2008
    #1
    Hi guys,

    By calling
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mad:"http://www.google.com"]];

    my application can lunch google web page. But my original application is closed.

    How can I embedded the web page into my application? Some people said we can use the code below to achieve my purpose:

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@"expected:%d, got:%d", UIWebViewNavigationTypeLinkClicked, navigationType);
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mad:"http://www.google.com"]];
    return NO;
    }

    return YES;
    }

    It seems we need to create webView. How to do it? I hope the google page will be inside on my application.

    I need your help. comments or sample code are welcome.

    Thank you,

    Forrest
     
  2. ace2600 macrumors member

    Joined:
    Mar 16, 2008
    Location:
    Austin, Texas
    #2
    UICatalog sample code on the developer page has a WebView which does just that.
     

Share This Page