Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page Curl #3

Open
mineshpurohit opened this issue Nov 24, 2011 · 4 comments
Open

Page Curl #3

mineshpurohit opened this issue Nov 24, 2011 · 4 comments

Comments

@mineshpurohit
Copy link

Is there an option for page curl, instead of slide?

Thank you.

@fedefrappi
Copy link
Owner

Hi, unfortunately there is no such option at the moment and its implementation wouldn't be straightforward

@ssutee
Copy link

ssutee commented Mar 7, 2012

I'm working on this issue.

It can be done by using UIPageViewController (iOS 5).

But the model that has to be used for UIPageViewController is quite different from the one that AePubReader uses.

@zeroCoder1
Copy link

I am commenting on a 3 month old post, anyway

@mineshpurohit if you see this piece of code:
https://github.com/zeroCoder1/Epub-Reader/blob/master/testPubb/testPubb/ViewController.m#L207

I have managed to put in a page curl, may be you can try some similar stuff. I don't know if I am right, but I managed to do it like this.

If you are satisfied with the answer you can close the issue.
If you have found a better way to do it, you can share it with us too. It will be useful

Cheers.

@vikysaran
Copy link

Page curl was done in one of closed topics. Just replace these three methods-
- (void) gotoNextSpine
- (void) gotoNextPage
- (void) gotoPrevPage
with given below:

- (void) gotoNextSpine {
    if(!paginating){
        if(currentSpineIndex+1<[loadedEpub.spineArray count]){
            [self loadSpine:++currentSpineIndex atPageIndex:0];

            CATransition *transition = [CATransition animation];
            [transition setDelegate:self];
            [transition setDuration:0.5f];
            [transition setType:@"pageCurl"];
            [transition setSubtype:@"fromRight"];
            [self.webView.layer addAnimation:transition forKey:@"CurlAnim"];
        }
    }
}

- (void) gotoNextPage
{
    if(!paginating)
    {
        if(currentPageInSpineIndex+1<pagesInCurrentSpineCount)
        {
            [self gotoPageInCurrentSpine:++currentPageInSpineIndex];
            CATransition *transition = [CATransition animation];
            [transition setDelegate:self];
            [transition setDuration:0.5f];
            [transition setType:@"pageCurl"];
            [transition setSubtype:@"fromRight"];
            [self.webView.layer addAnimation:transition forKey:@"CurlAnim"];
        }
        else
        {
            [self gotoNextSpine];
        }
    }
}

- (void) gotoPrevPage
{
    if (!paginating)
    { if(currentPageInSpineIndex-1>=0)
    {
        [self gotoPageInCurrentSpine:--currentPageInSpineIndex];
        CATransition *transition = [CATransition animation];
        [transition setDelegate:self];
        [transition setDuration:0.5f];
        [transition setType:@"pageUnCurl"];
        [transition setSubtype:@"fromRight"];
        [self.webView.layer addAnimation:transition forKey:@"UnCurlAnim"];
    }
        else
        {
            if(currentSpineIndex!=0)
            {
                CATransition *transition = [CATransition animation];
                [transition setDelegate:self];
                [transition setDuration:0.5f];
                [transition setType:@"pageUnCurl"];
                [transition setSubtype:@"fromRight"];
                [self.webView.layer addAnimation:transition forKey:@"UnCurlAnim"];
                int targetPage = [[loadedEpub.spineArray objectAtIndex:(currentSpineIndex-1)] pageCount];
                [self loadSpine:--currentSpineIndex atPageIndex:targetPage-1];
            }
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants