我想从UIViewController回到UITableViewControllerUITableViewControllerUITabBarController的子视图。我为此编写了以下代码。但是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不会加载。

ios - 从Nib-File移走后如何显示UITabBarController-LMLPHP

还是我尝试了一下,但是当我从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/

10-13 07:05