我正在尝试建立电子书,翻页(从左到右)并缩放。
到目前为止,我已经测试了一些项目,但是没有一个项目足以同时完成这两个项目。
我决定自己构建一个,所以我从这样的基本翻转动画开始:
- (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做到这一点吗?还是更好的选择?
最佳答案
您还应该看看CATansition
。看看this example。
另外,您是否查看过UIViewAnimationOptions的页面动画的UIViewAnimationOptionTransitionCurlUp
和UIViewAnimationOptionTransitionCurlDown
?
关于ios - 从中间动画UIImageView翻转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22904423/