Skip to content

Commit

Permalink
Handled loading and anchor of a internal page outside the book pages.
Browse files Browse the repository at this point in the history
See issue Simbul#64
  • Loading branch information
Xm4s committed Oct 16, 2011
1 parent e19cb2b commit dc32459
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Classes/RootViewController.m
Expand Up @@ -858,11 +858,17 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
// ****** Handle: file://
NSLog(@" Page is a link with scheme file:// --> load internal link");

anchorFromURL = [[url fragment] retain];
anchorFromURL = [[url fragment] retain];
NSString *file = [[url relativePath] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

int page = (int)[pages indexOfObject:file] + 1;
int page = [pages indexOfObject:file];
if (page == NSNotFound)
{
// ****** Internal link, but not one of the book pages --> load page anyway
return YES;
}

page = page + 1;
if (![self changePage:page] && ![webView isEqual:indexViewController.view])
{
if (anchorFromURL == nil) {
Expand All @@ -871,6 +877,7 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)

[self handleAnchor:YES];
}

else if ([webView isEqual:indexViewController.view])
{
discardNextStatusBarToggle = NO;
Expand Down

0 comments on commit dc32459

Please sign in to comment.