Tag: selectedindex

标签栏没有select委托方法给予先前选定的标签索引在ios中,swift 3

我试图检测用户select哪个标签,实时。 作为一个例子,如果用户select0 th索引,同时我想让用户select第zeroth索引选项卡。 所以为此,我使用tabbarcontroller委托方法。 override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) { print("the selected index is : \(selectedIndex)") } 但是这显示了以前的视图controller.as例如认为我在second tab ,然后我select第first tab然后这打印索引为2我怎样才能得到正确的select选项卡。 希望你的帮助。