Ios 从Nib文件移动后如何显示UITabBarController
我想从Ios 从Nib文件移动后如何显示UITabBarController,ios,swift,xcode6,uitabbarcontroller,uitabbar,Ios,Swift,Xcode6,Uitabbarcontroller,Uitabbar,我想从UIViewController返回到UITableViewControllerUITableViewController是UITabBarController的子视图。我为此编写了以下代码。但是UITabBarController不加载。我搜索并找到了,但当我通过链接移动时,我看到未找到页面。它是如何通过编程实现的?请帮帮我 @IBAction func backPlaylistTable(sender: UIBarButtonItem) { if boolForSo
UIViewController
返回到UITableViewController
UITableViewController
是UITabBarController
的子视图。我为此编写了以下代码。但是UITabBarController
不加载。我搜索并找到了,但当我通过链接移动时,我看到未找到页面。它是如何通过编程实现的?请帮帮我
@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
,但当我移动到第三个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
按索引选择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)
}
您是否将UITableController作为UINavigationController的rootViewController?UITableController是RootViewControllerUITableController有三个UITableViewController。我想加载第三个控制器,但UITabBarController没有加载。请确保tabbarController有三个表?检查tabbarController.viewControllers。如果count==1,你需要检查你的tabBarController。是的,请看我的问题。我更新了它。我想从第三个UIViewController移动到第三个UITableViewController,但是当我移动到第三个UITableViewController时,UITableController不会加载。让passToAbbarController=storyboard.InstanceeviewController的标识符(“mainTabBarController”)作为!超宽带控制器;passToTaBBarController..selectedIndex=2;presentViewController(passToTaBBarController,动画:true,完成:nil)