我需要将 tabBarController!.selectedIndex
数字放在常量中。
根据我选择的选项卡,我希望得到一个介于 0 和 3 之间的数字,但我却得到了像 2147483647
知道这是为什么吗?
代码是:
let selectedTab = tabBarController!.selectedIndex
print(selectedTab)
最佳答案
那个值是 NSNotFound。在这种情况下,它似乎代表“没有选择”。
关于Swift 2.1- tabBarController!.selectedIndex 返回大量整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33977085/