如何在UITabcontroller中调用新的UIViewController

时间:2016-05-23 12:20:54

标签: swift uitabbarcontroller

我有一个UITabContrroller(这里是WelcomeViewController),当我点击其中一个标签项页面上的一个按钮时,它会显示一个弹出框(PopViewController),另一个按钮用于显示新页面(SecondPageViewController),但是应该显示相同的标签父UITabContrroller。

首先,我尝试从PopViewController按钮选择Sequee并取消注释prepareForSegue,但它没有用。

后来我尝试将WelcomeViewController(Tabbar所在的位置)与seguee连接到SecondPage。

按钮代码如下:

 @IBAction func goToCarerUpdateProfile(sender: UIButton) {
let careerPageView =  self.storyboard?.instantiateViewControllerWithIdentifier("WelcomeViewControllerIdentifier") as! WelcomeViewController
        careerPageView.performSegueWithIdentifier("pushToCarerUpdateProfileSegue", sender: self)
}

此代码调用WelcomeViewControllerIdentifier的prepareForSegue函数,但没有第二页可见。

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "pushToCarerUpdateProfileSegue" {

            print("This portion working")
            let svc = segue.destinationViewController as? CarerUpdateProfileViewController

        }

如何在UITabcontroller中调用新的UIViewController? conditionn是新视图应具有与之前相同的选项卡。

0 个答案:

没有答案