views:

35

answers:

1

I am designing an app which will present large amounts of text that is interspersed with notes and references as clickable images. On a PC I'd use a control that shows HTML, but in the iPhone I am not able to intercept the touches of images and links too well using the UIWeb control.

Should I use a UIScroll and build the text as lables and UIImages perhaps?

Looking for the best way forward in my design phase.

+1  A: 

I don't know what your requirements are obviously, but it is possible to capture the click on an link in a UIWebView and take some alternative action. In one of my Apps, I have a UIWebView with one particular link which I want to route differently, while I let all other links open as web pages in the UIWebView as normal. Here's the code snippet from the app which accomplishes this. It is within a UIViewController which loads the UIWebView:

- (BOOL)webView:(UIWebView *)webView 
shouldStartLoadWithRequest:(NSURLRequest *)request 
 navigationType:(UIWebViewNavigationType)navigationType {

    NSURL *url = [ request URL ];
    if( [[url path] isEqualToString:@"/the_special_link.html"] ) {
        // Take some alternative action and then stop the page from loading...
        // (code to take some special action goes here)
        return NO;
    }
    else {
        return YES;
    }
}

This is a delegate method call, so when I set up the UIWebView, which I do programmatically in the Controller loadView method, I set the WebView's delegate to that same Controller:

myWebView.delegate        = self; 
Devin Ceartas