导航控制器中的 Segue to Tab 会转到错误的选项卡、Swift、Xcode
我正在单击一个按钮,然后推到塔巴尔控制器。
当我单击按钮时,它仅转到第一个选项卡,无论我在准备区域的准备中投入了什么号码。
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let barViewControllers = segue.destination as! UITabBarController
let nav = barViewControllers.viewControllers![2] as! UINavigationController
let destinationViewController = nav.topViewController! as UIViewController
}
它应该去的是具有棕色背景(数字2,第三个选项卡)
I am clicking a button and pushing to a TabBar Controller.
When I click the button it goes to the first tab only, no matter what number I put in the prepare for segue area.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let barViewControllers = segue.destination as! UITabBarController
let nav = barViewControllers.viewControllers![2] as! UINavigationController
let destinationViewController = nav.topViewController! as UIViewController
}
The one it should go to is the one with the brown background (Number 2, Third Tab)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论