【发布时间】:2017-11-24 19:59:28
【问题描述】:
我的Main.storyboard 文件中有一个TabBarController。
在我的Upload.storyboard 中,我从Main.storyboard 文件中展示了一个ViewController,但是,它不包含标签栏。
viewProfile 按钮应转到名为 Sharks 的选项卡,并在其中显示基于在 Upload.storyboard(模态视图)中收集的数据的视图控制器。
我可以通过编程方式添加标签栏还是我没有正确显示正确的 VC?
// MARK: - Actions
@IBAction func viewProfileButtonPressed(_ sender: UIButton) {
let stb = UIStoryboard(name: "Main", bundle: nil)
let sharkProfile = stb.instantiateViewController(withIdentifier: "sharkProfile") as! SharkProfileTableViewController
self.present(sharkProfile, animated: true) {
// add tab bar here?
}
}
【问题讨论】:
-
你想在这里发生什么?您是否从标签栏开始,点击“viewProfile”,然后您想要显示“SharkProfile”代替该标签的当前视图?你想让“SharkProfile”像典型的导航控制器一样从右侧滑入吗?还是您希望“SharkProfile”拥有自己的独立标签栏?
-
该应用程序以标签栏开始 - 但随后我将呈现一个没有标签栏的模式视图。在这个模态视图中,点击 viewProfile 应该会显示 SharkProfile,因为它在 Main.storyboard 中(带有标签栏)。
标签: ios swift xcode uitabbarcontroller uistoryboard