iOS上的iBook图像卷曲动画
问题描述:
我正在研究iPhone
应用程序,其中我有5-6套图像。我想使用页面卷曲动画(例如iBook
)更改图像,用户可以按页面卷曲动画的手指移动来滑动页面。我想要在iPhone上实现相同的动画..有什么办法可以不使用私有库或UIPageViewController
或者如果有任何样本可以实现这一点?iOS上的iBook图像卷曲动画
除了谷歌搜索我得到某种libaries如:
叶
paperstack
XBPagecurl
pagecurling
没有得到太多的帮助。
答
请不要去确切的解决方案,上面的解决方案会给你一些想法,你可以在这方面的工作,并扩大它。这样你学得越多,玩的越多。我有建议的博客,请通过它探索它。在你看来像这样
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(curlAnimation)];
[gesture setDirection:UISwipeGestureRecognizerDirectionLeft];
[self.view1 addGestureRecognizer:gesture];
答
添加滑动手势使用下面的代码片段
- (void)curlAnimation
{
[UIView animateWithDuration:1.0
animations:^{
CATransition * animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.2f];
animation.startProgress = 0.0;
animation.endProgress = 1;
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
[animation setType:@"pageCurl"];
[animation setSubtype:@"fromRight"];
[animation setRemovedOnCompletion:NO];
[animation setFillMode: @"extended"];
[animation setRemovedOnCompletion: NO];
[[self.view1 layer] addAnimation:animation
forKey:@"pageFlipAnimation"];
}
];
}
可以代替设置“fromLeft”使卷曲动画fromRight in this method [animation setSubtype:@"fromRight"]
用于从左至右动画
编码快乐..
看到这个http://www.iostute.com/2015/04/how-to-implement-partial-and-full-page.html –
感谢庵埠。我已经看过它。但是这是通过点击具有预定义动画持续时间和时间的按钮而发生的。我希望按照用户在iBooks应用程序中实现的手指移动来使用此功能。 –
定制你的自我添加代码的手势多数民众赞成在所有 –