views:

261

answers:

1

Some Background

I have an iPhone app with three UIWebViews, each used to show a different type of page. (The content is specifically designed for this purpose, they're not real web pages.) There are links associated with each specific web view. For example, a link tapped in WV1 might need to load in WV2 because it's a WV2-style link. (The webviews are in a paged UIScrollView, which I use to scroll to the currently loading webview. I can tell which URL loads where based on it's path.)

It makes sense to me to have a single UIWebView delegate that responds to all URLRequests (via webView:shouldStartLoadWithRequest:navigationType) and somehow decides which should load where.

The HTML I want to load in the webview isn't fetched directly from a page. I do something like [NSDictionary dictionaryWithContentsOfURL:] to get the object, part of which is the actual HTML. (Additionally, this might come from the network or a local cache.)

The Question

I need to cancel a request in one UIWebView and then load some arbitrary data into another. How should I be doing the subsequent load, so that it bypasses my interception?

Should I stop all intercept all NSURLRequests via the webview delegate method, then send a new NSURLRequest, that will actually get loaded, to the correct webview? I was thinking I'd subclass NSURLRequest so I'd be able to tell original requests separate from my doctored requests. But again, I don't want to make straight NSURLRequests, I want to fetch an NSDictionary and use one of it's values as the HTML.

I saw this article on filtering what loads in a UIWebView, but I don't think that's exactly what I want.

I'm trying to work my way through the URL Loading System Overview, but there's a lot there.

A: 

Ended up using custom URL schemes to identify the requests that I wanted to load vs. the ones I wanted handled.

zekel