2016-03-09 47 views
0

我想呈现并推送到另一个故事板文件中的视图控制器。但是我无法摆脱TabBar的显示效果,这是我的代码和我如何设置的屏幕截图。从应用委托推视图控制器

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { 
    let rootView = self.window!.rootViewController as! TabBarViewController 
    rootView.selectedIndex = 4 
    let storyBoard = UIStoryboard(name: "Main", bundle: nil) 
    let navVC = storyBoard.instantiateViewControllerWithIdentifier("moreNav") as! UINavigationController 
    storyBoard.instantiateViewControllerWithIdentifier("moreView") as! MoreTableViewController 
    let vc = navVC.visibleViewController as! MoreTableViewController 


    let pdfLockerSB = UIStoryboard(name: "PDFLocker", bundle: nil) 
    let pdfvc = pdfLockerSB.instantiateViewControllerWithIdentifier("pdfLockerTable") as! PDFLockerTableViewController 

    vc.navigationController?.pushViewController(pdfvc, animated: true) 

    return true 
} 

enter image description here

任何想法我做错了吗?这是一个UITabBarController链接到一个UINavigationController链接到一个UITableViewController。

我有segue所有设置,但我不知道它为什么不执行它。使用一键或执行

+0

你得到黑屏? – techloverr

+0

不,我不是。我得到更多屏幕。它只是没有继续下去。 – trever

+0

那个navigationVC的索引是4,对吗? – techloverr

回答

1

尝试这种

let navVC: UINavigationController = rootView.viewControllers![4] as! UINavigationController; 
let vc = navVC.topViewController as! MoreTableViewController 

代替

let navVC = storyBoard.instantiateViewControllerWithIdentifier("moreNav") as! UINavigationController 
let vc = navVC.visibleViewController as! MoreTableViewController 
+0

是的!这工作!你能解释一下真正的区别吗? – trever

+0

你正在创建新的实例,而不是参考 – techloverr

+0

请upvote请所以你可以信任它 – techloverr

相关问题