0

我将在 Swift 4 的 XLPagerTabStrip 库中检测滑动或选择选项卡事件。我只需要在所选选项卡更改时获取选项卡索引。所以我检查了 Github 中的库,但没有找到任何好的解决方案。

谢谢。

4

2 回答 2

3

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.

于 2018-03-22T18:40:56.813 回答
0

您可以简单地覆盖 updateContent

override func updateContent() {
    super.updateContent()
    // your code ....
}

于 2022-02-07T16:03:26.183 回答