我将在 Swift 4 的 XLPagerTabStrip 库中检测滑动或选择选项卡事件。我只需要在所选选项卡更改时获取选项卡索引。所以我检查了 Github 中的库,但没有找到任何好的解决方案。
谢谢。
我将在 Swift 4 的 XLPagerTabStrip 库中检测滑动或选择选项卡事件。我只需要在所选选项卡更改时获取选项卡索引。所以我检查了 Github 中的库,但没有找到任何好的解决方案。
谢谢。
So I didn't find a solution from the library itself but, I used viewWillDisappear and for every time you swipe away of the view this function will be called. Should be written as follows in your child view controller:
override func viewWillDisappear(_ animated: Bool) {
//Do your thing here
}
You can read more about this callback function here.
您可以简单地覆盖 updateContent
override func updateContent() {
super.updateContent()
// your code ....
}