简体   繁体   English

从UIViewController过渡到TabBarViewController

[英]Transition from UIViewController to TabBarViewController

I have been searching for a solution for 6 hours, and come up with nothing that applies to my situation. 我一直在寻找解决方案达6个小时,但没有找到适合我的情况的解决方案。 my storyboard follows the flow of: 我的故事板遵循以下流程:

TabBarViewController -> NavigationController ->TableViewController -> UIViewController (see picture below) TabBarViewController-> NavigationController-> TableViewController-> UIViewController(请参见下图)

故事板的图片

When the "Notify" button, in the last view controller (Stranger view controller), is clicked, I want to programmatically transition/segue from that View Controller(Stranger View Controller), to a different child of the TabBarViewController (it is the controller titled "Look Around" within the illustration). 单击最后一个视图控制器(陌生人视图控制器)中的“通知”按钮时,我想以编程方式从该视图控制器(陌生人视图控制器)过渡/选择到TabBarViewController的另一个子项(它是控制器)在插图中标题为“环顾四周”。

Every time I perform a traditional segue: 每次我执行传统的赛格:

  1. option + drag segue from Stranger View Controller --> Look Around View controller 选项+从Stranger View Controller拖动se​​gue->环视View控制器
  2. Give segue an identifier 给segue一个标识符
  3. programmatically use self.performSegueWithIdentifier. 以编程方式使用self.performSegueWithIdentifier。

I get a transition. 我有一个过渡。 but the "Look Around" tab bar is gone in the storyboard, and in the simulator, once I hit "Notify", the view changes to the "look around" view, but the tab bar below does not reflect that change, as it still has the previous tab highlighted. 但是情节提要板上的“环顾四周”选项卡栏消失了,在模拟器中,当我单击“通知”时,视图变为“环顾四周”视图,但是下面的选项卡栏没有反映该更改,因为它仍然突出显示上一个标签。

I have already handled all the other processing within the IBAction function that I need to handle. 我已经处理了我需要处理的IBAction函数中的所有其他处理。 It is just a matter of, correctly, sending the user to a different view, once they have hit "Notify". 正确的做法是,一旦用户点击了“通知”,就将用户转到另一个视图。

Any guidance on this would be greatly appreciated. 任何对此的指导将不胜感激。

If you have any questions or concerns for me, please do not hesitate to ask. 如果您对我有任何疑问或疑虑,请随时提出。 I am new at this, and am open to any help. 我是新来的人,愿意接受任何帮助。

ViewController is a child of NavigationBar and NavigationBarController is a Child of TabBarController. ViewController是NavigationBar的子级,而NavigationBarController是TabBarController的子级。 So Segue is not required as it will disturb the flow. 因此不需要Segue,因为它将干扰流程。

Try programmatically 以编程方式尝试

@IBAction func notifyButtonTapped(sender: AnyObject) {
        tabBarController?.selectedIndex = 1
        tabBarController?.tabBar.hidden = false
        self.navigationController?.popToRootViewControllerAnimated(false)
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从UIViewController调用tabbarviewcontroller? - How to call tabbarviewcontroller from UIViewController? 从UIViewController过渡到另一个 - Transition from UIViewController to Another 从SKScene过渡到UIViewcontroller - Transition from SKScene to UIViewcontroller 如何从UIViewController过渡到UINavigationController - How to transition to a UINavigationController from a UIViewController 如何实现从UICollectionViewController到UIViewController的自定义UIViewController转换? - How can I achieve this custom UIViewController Transition from UICollectionViewController to UIViewController? 从Tableview自定义单元格翻转到UIViewController - Flip Transition from a Tableview Custom Cell to a UIViewController 导航抽屉中的UIViewController之间的过渡 - transition between UIViewController from navigation drawer UIPageViewController从子UIViewController上的控件过渡 - UIPageViewController transition from control on child UIViewController 从UINavigationController中解除具有自定义转换的UIViewController时出现黑屏 - Black screen when dismissing a UIViewController with custom transition from within a UINavigationController UIViewController在另一个UIViewControler下从左到右过渡 - UIViewController transition from left to right beneath another UIViewControler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM