Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drewgarcia23

macrumors newbie
Original poster
Jun 2, 2012
1
0
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:

Code:
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?
 
Last edited by a moderator:
You should be able to accomplish what you want using the UIWebViewDelegate, specifically the
Code:
webView:shouldStartLoadWithRequest:navigationType:
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.