如何在iOS上实现页面滑动效果

时间:2012-05-17 05:37:16

标签: ios animation gesture epub

我正在创建一个读取ePub文件的ePub阅读器。我想实现类似于实体书的页面幻灯片效果。 For example

这是什么动画?这不起作用:

- (void)loadPage{

[UIView beginAnimations:nil context:nil]; 
    //change to set the time 
    [UIView setAnimationDuration:1]; 
    [UIView setAnimationBeginsFromCurrentState:YES]; 
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES]; 

    // do your view swapping here 
    [UIView commitAnimations];
}
滑动

- (void)swipeRightAction:(id)ignored
{
    NSLog(@"Swipe Right");
    if (_pageNumber>0) {

        _pageNumber--;
        [self loadPage];
    }

}

- (void)swipeLeftAction:(id)ignored
{
    NSLog(@"Swipe Left");

    if ([self._ePubContent._spine count]-1>_pageNumber) {

        _pageNumber++;
        [self loadPage];
    }

}

1 个答案:

答案 0 :(得分:1)

我对第三方api做了同样的事情。您可以参考以下网址

https://github.com/jemmons/PageCurl

https://github.com/xissburg/XBPageCurl

https://github.com/brow/leaves