anchors in a UIWebView

I am displaying an HTML document including many pages using a UIWebView.
How can I select from the code which page to display, given that each page has an anchor associated with it?


Thanks

Mac Mini, Mac OS X (10.5.5)

Posted on Nov 4, 2008 7:46 AM

Reply
3 replies

Nov 5, 2008 4:14 PM in response to rab101

Let's say you have 'page.html' in your resources directory and it contains the anchor 'anchor1' you can do this:


NSString *basePath = [[NSBundle mainBundle] pathForResource:@"page.html" ofType:nil];
NSURL *baseURL = [NSURL fileURLWithPath:basePath];
NSURL *fullURL = [NSURL URLWithString:@"#anchor1" relativeToURL:baseURL];
// Now do whatever with this fullURL


Message was edited by: RickMaddy

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

anchors in a UIWebView

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.