ios - 从中间动画UIImageView翻转

标签 ios objective-c animation flip

我正在尝试建立电子书,翻页(从左到右)并缩放。
到目前为止,我已经测试了一些项目,但是没有一个项目足以同时完成这两个项目。
我决定自己构建一个,所以我从这样的基本翻转动画开始:

- (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的页面动画的UIViewAnimationOptionTransitionCurlUpUIViewAnimationOptionTransitionCurlDown

关于ios - 从中间动画UIImageView翻转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22904423/

相关文章:

ios - ios 中的 RTL 自定义表格 View 单元格

ios - 在运行时检查/加载核心数据

ios - 如何让iOS ImageView满配窗口?

javascript - 尝试根据与按钮顺序的匹配打开 div [ordered](类似于 Accordion )

android - built-in Animation 适合长时间运行的慢动画吗?

javascript - Highcharts 关闭柱形图的动画

ios - 当从 iOS 13.1 中的 SceneDelegate 设置 RootViewController 时,UIElements 变为非事件状态

objective-c - 如何使用 cocoa API 检查 OSX 的滚动方向

iphone - _OBJC_CLASS_$ iOS 应用程序错误

iphone - 在 Storyboard 中创建自定义 UITableViewCell