UIWebView Help

Discussion in 'iOS Programming' started by drewgarcia23, Jun 2, 2012.

  1. drewgarcia23, Jun 2, 2012
    Last edited by a moderator: Jun 2, 2012

    drewgarcia23 macrumors newbie

    Jun 2, 2012
    Okay so Im not sure if this site can help me but I figured I would try it out.

    I built a mobile webpage and you can view it in the iPhone app I am creating now. The mobile webpage has different photo albums. Long story short, I would like WHEN user clicks one photo album for an UIImageView to pop up instead of viewing the photo album through the mobile website.

    I thought of something like this:

    NSString *currentURL = webViewPictures.request.URL.absoluteString; 
    if ([currentURL rangeOfString:@"id="].location == NSNotFound) {
        NSLog(@"string does not contain id=");
    } else {
        webViewPictures.hidden = true;
    So it can tell when I open a photo album, because each photo album contains "id=" in the URL. But my code doesn't constantly check every URL it goes to. I don't know how to do this.

    Any ideas? Or different ways around this?
  2. ppilone macrumors 6502

    Jan 20, 2008
    You should be able to accomplish what you want using the UIWebViewDelegate, specifically the
    callback. The web view should send this to its delegate whenever the user clicks a link (presumably your images). You can check the URL in the request and, if necessary, show your image in an image view and respond with NO.

Share This Page