Open jdpecson opened 12 years ago
Here's what I've done to implement this.
Changed this method in EPubViewController.m
and in viewDidLoad I changed this part of the code...
...
UIScrollView* sv = nil; for (UIView* v in webView.subviews) { if([v isKindOfClass:[UIScrollView class]]){ sv = (UIScrollView*) v; sv.scrollEnabled = YES; sv.showsHorizontalScrollIndicator = NO; sv.showsVerticalScrollIndicator = NO; sv.bounces = NO; sv.delegate = self; } }
...
Lastly I added the UIScrollViewDelegate protocol on the header file and implemented this delegate method.
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { if (scrollView.contentOffset.x <= 0.0f) { [self gotoPrevSpine]; } else if ((scrollView.contentOffset.x + scrollView.frame.size.width) >= scrollView.contentSize.width) { [self gotoNextSpine]; } }
Viola! One problem though it's pretty fast in scrolling.
I found some issue about going to previous spine, it starts at the first page of the chapter. That's why instead of..
[self loadSpine:++currentSpineIndex atPageIndex:0];
I changed it to..
int targetPage = [[loadedEpub.spineArray objectAtIndex:(currentSpineIndex-1)] pageCount];
[self loadSpine:--currentSpineIndex atPageIndex:targetPage-1];
So it will now go to the last page of the previous chapter.
@jdpecson Can you send me your two page sample code ??? my mail is sendercustom@yahoo.com.tw Thank you
@jdpecson hey can you plz share a code of two page display in landscape mode ? I am struggling for the same but unable to achieve it. can you send the code for it to javalnanda@gmail.com
I achieved it by changing the following code in webViewDidFinishLoading of EpubViewController.m
NSString *insertRule1 = [NSString stringWithFormat:@"addCSSRule('html', 'padding: 0px; height: %fpx; -webkit-column-gap: 0px; -webkit-column-width: %fpx;')", webView.frame.size.height, webView.frame.size.width ];
to
NSString *insertRule1 = [NSString stringWithFormat:@"addCSSRule('html', 'padding: 0px; height: %fpx; -webkit-column-gap: 0px; -webkit-column-width: %fpx;')", webView.frame.size.height, webView.frame.size.width / 2];
Could you send me your two page sample code MailID is prasanna.d@greatinnovus.com
please send the code i am handling the critical situation in my project Thank you
Please find the solution for two page mode in following post : http://stackoverflow.com/questions/11823649/rendering-epub-in-two-page-mode
Is there a way on how i can make it display on two page on landscape orientation?
Thank you very much!