iPhone 应用程序中的横向模式页面卷曲问题

发布于 2024-12-26 05:29:07 字数 1114 浏览 3 评论 0原文

在我的应用程序中,我有卷页效果。卷页效果在纵向模式下正常工作,而在横向模式下,卷页结束发生在 i pad 的一角。

在横向模式下,我希望页面在中间分开,如下图所示。在此处输入图像描述

但是我的页面卷曲效果如下图所示。在此处输入图像描述

我正在使用以下代码:

-(void)PresentView
{
    [UIView animateWithDuration:1.0  animations:^
    {
                         CATransition *animation = [CATransition animation];

                         [animation setDelegate:self];
                         [animation setDuration:0.7];

                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

                         animation.type = @"pageCurl";

                         animation.fillMode = kCAFillModeForwards;
                         animation.endProgress = 0.65;

                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageCurlAnimation"];  

                         [m_container addSubview:self];
                         ;}  

     ];    
}

如何获取页面横向模式下的卷曲动画如第一张图所示?

In my app, I have a page curl effect. The page curl effect works correctly in portrait mode whereas in landscape mode the page curl ending takes place at the corner of the i pad.

In landscape mode I want the page to be get separated in the middle as in the following figure.enter image description here

But my page curl effects looks as the following figure.enter image description here

I am using the following code:

-(void)PresentView
{
    [UIView animateWithDuration:1.0  animations:^
    {
                         CATransition *animation = [CATransition animation];

                         [animation setDelegate:self];
                         [animation setDuration:0.7];

                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];

                         animation.type = @"pageCurl";

                         animation.fillMode = kCAFillModeForwards;
                         animation.endProgress = 0.65;

                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageCurlAnimation"];  

                         [m_container addSubview:self];
                         ;}  

     ];    
}

How do I get the page curl animation in landscape mode as in the first figure?

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

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

发布评论

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

评论(1

围归者 2025-01-02 05:29:07

需要调整UIPageViewController的两个属性:

  • doubleSided设置为YES,这样每个页面的两面都有内容
  • 设置spinLocationUIPageViewControllerSpineLocationMid 以便您在视图中间加入两个页面

You need to adjust two properties of UIPageViewController:

  • Set doubleSided to YES, so that each page has content on both of its sides
  • Set spineLocation to UIPageViewControllerSpineLocationMid so that you have two pages joined in the middle of view
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文