Swift 2.1- tabBarController!.selectedIndex 返回大量整数

标签 swift integer uitabbarcontroller selectedindex

我需要将 tabBarController!.selectedIndex 数字放在常量中。

根据我选择的选项卡,我希望得到一个介于 0 和 3 之间的数字,但我却得到了像 2147483647

这样的数字

知道这是为什么吗?

代码是:

let selectedTab = tabBarController!.selectedIndex
print(selectedTab)

最佳答案

那个值是 NSNotFound。在这种情况下,它似乎代表“没有选择”。

关于Swift 2.1- tabBarController!.selectedIndex 返回大量整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33977085/

相关文章:

ios - TabBar 覆盖导航堆栈中的 View Controller 内容

ios - override func prepare(for segue : UIStoryboardSegue, sender : Any?) 未被调用

javascript - 生成指定范围内的随机数——各种情况(int、float、inclusive、exclusive)

c++ - 如何从循环生成的整数中删除前导零并将其存储为数组?

php - 尝试调用 MYSQL 过程以根据条件向 php 返回 int 值

ios - 如何知道标签栏的切换?

swift - 取消隐藏隐藏的标签栏 (tabbar)

ios - Swift:如何限制 CollectionView 中的 numberOfItemsInSection?

ios - 如何在 iOS App Swift 4 中集成 Paypal 支付方式?

ios - Swift 图标角标(Badge)编号感叹号