【发布时间】:2017-11-25 12:16:22
【问题描述】:
我正在尝试从我的Main.storyboard 文件中呈现一个SharkProfileTableViewController,并在没有标签栏的Upload.storyboard 的模态视图中的一个按钮操作中显示一个TabBarViewController。
我试图展示的 ViewController 是来自 SharksTableViewController 表视图的选定项,该表视图基于模态视图中的数据。
如何将SharkProfileViewController 与TabBarViewController 一起显示?
@IBAction func viewProfileButtonPressed(_ sender: UIButton) {
let stb = UIStoryboard(name: "Main", bundle: nil)
let tabBar = stb.instantiateViewController(withIdentifier: "tabBar") as! TabBarViewController
let sharkTabBar = stb.instantiateViewController(withIdentifier: "sharkTableView") as! SharksTableViewController
let sharkProfile = stb.instantiateViewController(withIdentifier: "sharkProfile") as! SharkProfileTableViewController
sharkProfile.selectedShark = shark as JSONObject
tabBar.selectedIndex = 3
self.present(tabBar, animated: true) {
}
}
TabBarController - 'Shark' 选项卡是应该显示的选项卡
SharksTableViewController - 当在这个 tableview 中选择一个项目时,它会显示 ...
【问题讨论】:
标签: ios swift uitableview uitabbarcontroller uistoryboard