使用 PerformSegueWithIdentifier 转至选项卡栏控制器
我正在学习 iOS,并且正在开发 XCode 4.2 中的概念验证应用程序。我本质上希望允许用户输入用户/通行证组合,如果用户位于对象数组中,则将它们传递到“内容”视图,但如果不是,则将它们传递到“注册”视图。
在任何一种情况下,由于应用程序本身将是一个选项卡式应用程序(尽管登录和注册视图不是选项卡式的),所以我需要能够从典型的 ViewController 过渡到 TabViewController。
- (void)logIn:(id)sender{
[self performSegueWithIdentifier:@"Content" sender:sender];
目前
,我让应用程序连接到正确的 ViewController,它是嵌入在 NavViewController 中的 TabBarController...但是一旦到达那里...就没有选项卡了!
我做错了什么?
I'm learning iOS and I'm working on what amounts to a Proof of Concept app in XCode 4.2. I essentially want to allow a user to enter a user/pass combo and if the user is in an array of objects, pass them on to the "Content" view, but if not, pass them on to the "Register" view.
In either case, since the app itself will be a tabbed app (though the login and register views are not tabbed), I need to be able to segue from a typical ViewController to a TabViewController.
- (void)logIn:(id)sender{
[self performSegueWithIdentifier:@"Content" sender:sender];
}
Currently, I have the app segueing to the proper ViewController, which is a TabBarController embedded in a NavViewController...but once it gets there...there are no tabs!!
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在您没有加载 TabBarController,这就是您没有任何选项卡的原因。
我的建议是:
在登录 ViewController 中,您还可以添加“注册”按钮,然后将其连接到注册视图控制器。
从登录按钮添加 IBAction,它将检查登录并通过,如果可以,则使用 Content ViewController 加载 Content ViewController 或 TabBar 控制器。
我强烈建议您学习 iOS5 故事板教程,以了解视图控制器如何交互。
Now you aren't loading TabBarController that's why you don't have any tabs.
What I suggest you:
In Log In ViewController you can also add "register" button, and place a segue from it to Register View Controller.
Add IBAction from log in button, which will check for log in and pass, and if it's OK load Content ViewController or TabBar Controller with Content ViewController.
I strongly recommend you to study iOS5 storyboard tutorials to get to know how the view controllers interacts.