从 Nib-File 移动后如何显示 UITabBarController

How to show UITabBarController after a move from Nib-File

我想从 UIViewController 回到 UITableViewControllerUITableViewControllerUITabBarController 的子视图。我为它写了下面的代码。但是 UITabBarController 没有加载。我搜索并找到 answer,但是当我移动到 link 时,我看到 找不到页面。它如何以编程方式制作?请帮助我。

  @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)
    }
}

我解决了。我更改了我的代码,它对我有用。我让 UITabBarController 将 select UITableViewController 按索引

  @IBAction func thirdPlaylist(sender: UIButton) {
        let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
        let passToTaBBarController = storyboard.instantiateViewControllerWithIdentifier("mainTabBarController") as! UITabBarController
        passToTaBBarController.selectedIndex = 2
        presentViewController(passToTaBBarController, animated: true, completion: nil)
    }