代码之家  ›  专栏  ›  技术社区  ›  Addev

如何避免动画禁用触摸交互(滚动、滑动等)

  •  1
  • Addev  · 技术社区  · 8 年前

    我试图在ViewController中的视图上制作动画。

    我的问题是,在动画完成之前,其他元素(如UITableViewControllers或UIPageViewControllers)上的滚动/滑动手势会被禁用。

    我如何避免这种行为?

    1 回复  |  直到 8 年前
        1
  •  4
  •   Rafał Sroka    8 年前

    使用 allowUserInteraction 选项:

    UIView.animate(withDuration: duration, delay: 0, options: .allowUserInteraction,
           animations: {
               // Your animations here
           },
                    completion: nil
    )