UIViewAnimationTransitionCurlUp 水平工作

发布于 2024-12-01 22:14:19 字数 884 浏览 4 评论 0原文

我尝试使 UIViewAnimationTransitionCurlUp 水平工作,因此我旋转应用动画的视图。但是这不起作用,动画保持从底部到顶部。有什么想法吗?

first = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
    container = [[UIView alloc] initWithFrame:CGRectMake(-96, 140, 960, 768)];
    container.backgroundColor = [UIColor redColor];
    container.transform = CGAffineTransformMakeRotation(M_PI * (0.5));
    [self.view addSubview:container];
    [container addSubview:first];


    second = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];


    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.5f];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:container cache:NO];
    [first removeFromSuperview];
    [container addSubview:second];
    [UIView commitAnimations];

I try to make the UIViewAnimationTransitionCurlUp work horizontally so, I rotate the view where the animation is applied. But the didn't work, the animation stay from the bottom to the top. Any idea?

first = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];
    container = [[UIView alloc] initWithFrame:CGRectMake(-96, 140, 960, 768)];
    container.backgroundColor = [UIColor redColor];
    container.transform = CGAffineTransformMakeRotation(M_PI * (0.5));
    [self.view addSubview:container];
    [container addSubview:first];


    second = [[PDFPortraitView alloc] initWithFrame:CGRectMake(0, 0, 960, 768) andCurrentPage:currentPage];


    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.5f];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:container cache:NO];
    [first removeFromSuperview];
    [container addSubview:second];
    [UIView commitAnimations];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔书几行 2024-12-08 22:14:19

尝试对视图的超级视图的变换应用 90 度旋转。这应该会改变视图的坐标空间,因此应用于子视图的卷曲过渡应该在旋转坐标中卷曲。

您可能必须创建多个视图以防止内容旋转:

外部视图,旋转 90 度。

中间视图 - 这是获得卷曲过渡的视图

   inner view, rotated -90 degrees, and containing your actual content.

我还没有尝试过,但应该可以。

请注意,您切换到的视图必须是中间视图/内部视图组合。

Try applying a 90 degree rotation to your view's superview's transform. That should transform your view's coordinate space, so a curl transition applied to the child view should curl in rotated coordinates.

You might have to create multiple views to keep your content from being rotated:

outer view, rotated 90 degrees.

middle view - this is the view that gets the curl transition

   inner view, rotated -90 degrees, and containing your actual content.

I haven't tried it, but that should work.

Note that the view you switch to will have to be a middle view/inner view combo.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文