【问题标题】:Change UIPageViewController Flip Animation更改 UIPageViewController 翻转动画
【发布时间】:2019-10-23 14:57:23
【问题描述】:

我有一个 UIPageViewController 可以更改 ViewControllers,默认为翻页动画

是否可以用简单的滑入/滑出动画替换此动画?例如,就像 Android ViewPager 所做的那样。

这是我的UIPageViewController 初始化:

var pageViewController = new UIPageViewController();
        pageViewController.DataSource = new InfoViewControllerDataSource(this, _pageTitles);
        pageViewController.SetViewControllers(new UIViewController[] { Pages[0] }, UIPageViewControllerNavigationDirection.Forward, false, null);
        pageViewController.View.Frame = new CGRect(0, _toolbar.Frame.Bottom, this.View.Frame.Width, this.View.Frame.Size.Height);
        AddChildViewController(this.pageViewController);

【问题讨论】:

    标签: ios objective-c swift xamarin.ios


    【解决方案1】:

    您可以从界面生成器中执行此操作。将 Transition 样式属性更改为 Scroll。如果您想以编程方式执行此操作,则 transitionStyle 是一个只读属性。只能由this method完成

    pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scr‌​oll, UIPageViewControllerNavigationOrientation.Horizontal)
    

    【讨论】:

    • 谢谢,在构造函数中添加样式就可以了。您可以在答案中添加此行pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal);,以便其他人更容易找到答案。
    【解决方案2】:

    可以在情节提要中做: 页面视图控制器

    导航:水平

    过渡样式:滚动

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-05
      • 2014-02-10
      • 1970-01-01
      • 2018-04-22
      • 1970-01-01
      • 1970-01-01
      • 2011-03-22
      • 2019-08-18
      相关资源
      最近更新 更多