如何在情节提要iphone中将两个viewcontrollers连接到相同的navigationcontroller [英] how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

查看:38
本文介绍了如何在情节提要iphone中将两个viewcontrollers连接到相同的navigationcontroller的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个可以在Appdelegate类中检查条件的应用程序,如下所示:-

I am doing an application where i can check for a condition in Appdelegate class as follows:-

if([[array count] == 0){one viewController} else {another viewController}

我将如何在情节提要中执行此操作,就像我要求连接时那样,以便显示相应的视图控制器.

How will i do this in storyboard like i'm asking the connection so that the corresponding viewcontrollers are displayed.

我是iPhone开发的新手,谢谢.

I'm new to iphone development.Thanks in advance.

推荐答案

方法是:

  1. 创建一个常规的UIViewController:这将是您的根视图控制器.
  2. 创建另外两个UIViewControllers.
  3. 在步骤1的根视图控制器到步骤2的2中创建2个segue.
  4. 将您的状况检查放入viewDidAppear:根据您的状况启动适当的segue.
  5. 在导航控制器中嵌入根视图控制器(转到Xcode中的 Editor 菜单,然后选择嵌入).
  1. Create a regular UIViewController: this will be your root view controller.
  2. Create the 2 other UIViewControllers.
  3. Create 2 segues from the root view controller in step #1 to the 2 in step #2.
  4. Put your condition check in the viewDidAppear: launch the appropriate segue based on your condition.
  5. Embed the root view controller in a navigation controller (go to the Editor menu in Xcode and then select Embed In).

这篇关于如何在情节提要iphone中将两个viewcontrollers连接到相同的navigationcontroller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆