Open isakvan opened 12 years ago
Hi! We're glad you found our code useful. You are correct, link handling wasn't implemented, you should take a look at the – webView:shouldStartLoadWithRequest:navigationType delegate method to detect when the user selects a link and act accordingly. Here is a link to the related documentation: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIWebViewDelegate
Bye, Federico
Hi Fedefrappi, thank you very mach!
It works for me fine but to define page in spine for anchors into XML it seems I need to use JavaScript or you search logic or another way?
I get code like this :
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
//path to called chapter
NSURL* url = [request URL];
NSString * newChapterURL = [url path];
//get chapter index by chapter path
int indexNewChapter = -1;
NSString *path;
for (int i=0; i<loadedEpub.spineArray.count & indexNewChapter == -1; i++) {
path = ((Chapter*)[loadedEpub.spineArray objectAtIndex:i]).spinePath;
if([path isEqualToString:newChapterURL]){
indexNewChapter = i;
}
}
[self loadSpine:indexNewChapter atPageIndex:0];
return NO;
}
return YES;
}
Bye, Isak
Thank you I used you search logic
Bye!
Hi all, first thanks to author for nice free code! I'm using it.
If it correct that this code no supply href to another xml file (<'a href='section-0801.xml'>Look Here<'/a>).
How to do it? Any idea? Thank you.