我想从UIViewController
回到UITableViewController
。 UITableViewController
是UITabBarController
的子视图。我为此编写了以下代码。但是UITabBarController
不会加载。我搜索并找到了answer,但是当我按链接移动时,我看到找不到页面。它是如何以编程方式制作的?请帮我。
@IBAction func backPlaylistTable(sender: UIBarButtonItem) {
if boolForSong == true {
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let playlistTable = storyboard.instantiateViewControllerWithIdentifier("playlistNavi") as! UINavigationController
presentViewController(playlistTable, animated: true, completion: nil)
}
}
UITableViewController
具有以下代码 override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.tabBarController?.tabBar.hidden = false
self.tableView.reloadData()
}
更新
我的
UITabBarController
。我更新了。我想从第三个UIViewController
移到第三个UITableViewController
,但是当我创建它时,UITabBarController
不会加载。还是我尝试了一下,但是当我从
UIViewConroller
移开时,UITabBarController打开第一个UITabBarController
,但是我想UITabBarController
打开第三个UITableViewController
@IBAction func thirdPlaylist(sender: UIButton) {
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let passToTaBBarController = storyboard.instantiateViewControllerWithIdentifier("mainTabBarController") as! UITabBarController
let playListTVC = storyboard.instantiateViewControllerWithIdentifier("playlistTVCStoryboard") as! UITableViewController
passToTaBBarController.selectedViewController?.presentViewController(playListTVC, animated: true, completion: nil)
presentViewController(passToTaBBarController, animated: true, completion: nil)
}
最佳答案
您需要加载UITabBarController
像这样更改代码:
@IBAction func backPlaylistTable(sender: UIBarButtonItem) {
if boolForSong == true {
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let tabCro = storyboard.instantiateViewControllerWithIdentifier("you tab cro id") as! UITabBarController
presentViewController(tabCro, animated: true, completion: nil)
}
}
关于ios - 从Nib-File移走后如何显示UITabBarController,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32468988/