我正在尝试构建一个电子书,翻页(从左到右)和缩放。 到目前为止,我已经测试了一些项目,但没有一个项目能够做到这两个项目。 我决定建立自己的一个,所以我开始使用这样的基本翻转动画:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.scrollView.delegate = self;
self.scrollView.maximumZoomScale = 5.0f;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
tapGesture.delegate = self;
tapGesture.numberOfTapsRequired = 1;
tapGesture.numberOfTouchesRequired = 1;
[self.scrollView addGestureRecognizer:tapGesture];
}
#pragma mark - UIScrollView Delegate
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imageView;
}
#pragma mark - UIGestureRecognizer Delegate
- (void)handleTap:(UITapGestureRecognizer *)tapGestur
{
NSLog(@"%s", __PRETTY_FUNCTION__);
if (tapGestur.state == UIGestureRecognizerStateEnded) {
[UIView transitionWithView:self.imageView duration:1 options:UIViewAnimationOptionTransitionFlipFromRight|UIViewAnimationOptionCurveEaseInOut animations:^{
if (!flipped) {
self.imageView.image = [UIImage imageNamed:@"2-IPAD-P.jpg"];
flipped = YES;
}
else {
self.imageView.image = [UIImage imageNamed:@"1-IPAD-P.jpg"];
}
} completion:^(BOOL finished) {
//
}];
}
}
我现在要做的是从图像中间过渡翻页(从左到右)。 知道如何使用UIVIew做到这一点?或者更好的选择?
答案 0 :(得分:0)
您还应该看看CATansition
。看看this example。
另外,您是否看过UIViewAnimationOptions的UIViewAnimationOptionTransitionCurlUp
和UIViewAnimationOptionTransitionCurlDown
页面动画?