【发布时间】:2018-08-02 05:05:43
【问题描述】:
我有两个动作。
我想执行第一个操作,然后调用第二个操作。如果我添加这样的操作:
func actions {
action1()
action2()
}
但在我的代码和操作中同时实现。
我在第一个操作中有此代码:
let pageController = self.storyboard?.instantiateViewController(withIdentifier: "PageViewController") as! UIPageViewController
pageController.dataSource = self
pageController.delegate = self
firstPage = 0
secondPage = 1
guard let firstController = getContentViewController(withIndex: firstPage) else { return }
guard let secondController = getContentViewController(withIndex: secondPage) else { return }
pageViewController?.setViewControllers([firstController, secondController], direction: .reverse, animated: true, completion: nil)
这是一个翻转动画。
如果我用这个
func actions {
action1()
action2()
}
我的翻转动画将无法显示。
也许我需要使用计时器?
【问题讨论】:
-
你应该在action1()完成时调用action2()