从普通视图切换到 TabBar 控制器
我构建了我的第一个 iPhone 应用程序,但在切换视图时遇到了问题。 首先,我有两个视图(登录、注册),它们通过“presentModalViewController:animated:”切换。
但如果有人登录,一定会有一种新的看法。我想在底部有一个 UITabBar (标签栏控制器)。但这是行不通的。我尝试创建一个新的 AppDelegate,以便我可以使用像这样需要 AppDelegate 的教程:
http://www.youtube.com/watch?v=LBnPfAtswgw&feature=player_embedded
切换到新控制器是这样完成的:
startViewController = [[StartViewController alloc] initWithNibName:@"StartView" bundle:nil];
[UIView beginAnimations:@"View Curl" context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:startViewController.view];
[UIView commitAnimations];
屏幕是白色的,因为显示的视图是 UIView在我的 StartView.xib 中。在那里我有新的 AppDelegate、文件的所有者、视图、TabBarController。但只加载了 UIView,而不加载 TabBarController。
你知道我如何解决这个问题吗?
谢谢&此致。
I build my first iPhone application and I have a problem with switching views.
First, I have two views (login, registration) which switch via "presentModalViewController:animated:".
But if someone logged in, there must be a new kind of view. I wanna have an UITabBar at the bottom (tab bar controller). But this does not work. I tried to create a new AppDelegate, so that I can use tutorials like this one which need a AppDelegate:
http://www.youtube.com/watch?v=LBnPfAtswgw&feature=player_embedded
The switch to the new controller is done like this:
startViewController = [[StartViewController alloc] initWithNibName:@"StartView" bundle:nil];
[UIView beginAnimations:@"View Curl" context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:startViewController.view];
[UIView commitAnimations];
The screen is white, because the shown view is the UIView in my StartView.xib. There I have the new AppDelegate, File's owner, View, TabBarController. But only the UIView is loaded and not the TabBarController.
Do you have an idea how I could this problem?
Thanks & Best Regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能建议您从 TabBarController 开始,如果未设置用户名/密码,则活动 ViewController 执行 PresentModalViewController:animated: 以模式模式显示登录/注册视图控制器(隐藏底层 TabBarController)。
以下是一些以编程方式执行此操作的示例代码。
I might suggest you start with a TabBarController, and if the username/password is not set, the active ViewController executes presentModalViewController:animated: to display the login/registration viewsControllers in modal mode (hidding the underliying TabBarController).
Here is some sample code for doing it programmatically.