iOS 上的 iBook 图像卷曲动画
iBook Image Curl Animation on iOS
我正在开发 iPhone
应用程序,我有 5-6 组图像。我想使用 iBook
之类的卷页动画来更改图像,用户可以根据卷页动画的手指移动来滑动页面。我想在 iPhone 上实现相同的动画。有什么方法可以不使用私有库或 UIPageViewController
或者是否有任何示例可以实现这个?
除了 google 搜索之外,我还得到了一些库,例如:
叶子
一叠纸
XBPagecurl
卷页
没有得到太多帮助。
请不要寻求精确的解决方案,上面的解决方案会给您一些想法,您可以继续研究并扩展它。这样你学得越多,玩得越多。我有建议的博客,请通过它探索它。
像这样在您的视图中添加滑动手势
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 [animation setSubtype:@"fromRight"]
用于从左到右设置动画
编码愉快..
我正在开发 iPhone
应用程序,我有 5-6 组图像。我想使用 iBook
之类的卷页动画来更改图像,用户可以根据卷页动画的手指移动来滑动页面。我想在 iPhone 上实现相同的动画。有什么方法可以不使用私有库或 UIPageViewController
或者是否有任何示例可以实现这个?
除了 google 搜索之外,我还得到了一些库,例如:
叶子
一叠纸
XBPagecurl
卷页
没有得到太多帮助。
请不要寻求精确的解决方案,上面的解决方案会给您一些想法,您可以继续研究并扩展它。这样你学得越多,玩得越多。我有建议的博客,请通过它探索它。
像这样在您的视图中添加滑动手势
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 [animation setSubtype:@"fromRight"]
用于从左到右设置动画
编码愉快..