Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

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 ID.