简体   繁体   English

如何在iPhone的一个标签下显示视图和子视图?

[英]How can I have a view and a subview under one tab on the iphone?

Here is my situation. 这是我的情况。 I have an app with four tabs. 我有一个带有四个标签的应用。 The first tab contains a registration screen. 第一个选项卡包含注册屏幕。 Once the user is registered I want the SAME tab to load a separate "Latest News" screen instead of the registration screen. 注册用户后,我希望“相同”选项卡加载单独的“最新新闻”屏幕而不是注册屏幕。 Any help would be appreciated. 任何帮助,将不胜感激。

This sounds like a design issue. 这听起来像是一个设计问题。 It's usually a better idea to display a registration/login view as a modal view. 通常最好将注册/登录视图显示为模式视图。 So when the registration is complete, you can dismiss the modal view, and underneath your "latest news" view would already be there. 因此,完成注册后,您可以关闭模​​式视图,并且“最新消息”视图下将已经存在。 Most likely, you don't want your users to be able to switch to another tab in the middle of the registration process, displaying it modally would take care of that issue as well. 您很可能不希望用户在注册过程中能够切换到另一个选项卡,以模态显示它也可以解决该问题。

Don't forget that UITabBarController is a UIViewController as well. 不要忘记UITabBarController也是UIViewController。 So you can simply do: 因此,您可以简单地执行以下操作:

[tabBarController presentModalViewController:registrationController];

And when you are done, dismiss it, and make sure your latest news tab is selected. 完成后,将其关闭,并确保选择了“最新新闻”选项卡。

Use navigation controller (UINavigationController). 使用导航控制器(UINavigationController)。

There are plenty of tutorials about iPhone apps navigation on the Web... 网上有很多关于iPhone应用程序导航的教程。

暂无
暂无

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

相关问题 你有一个视图可以作为iPhone的几个不同视图的子视图吗? - Can you have one view be a subview for several different views for iPhone? 如何直接移动到在第三个选项卡iPhone中作为子视图添加的视图 - How to directly move to a view which is added as subview in in third tab iPhone iPhone,我如何向mainWindow添加一次显示一次的视图,但没有标签栏按钮? - iPhone, how can I add a first view, show once, to a mainWindow but not have a tab bar button? 如何在iPhone中从主视图向子视图绘制/重画一条线? - how can I draw /redraw a line from main view into subview in iphone? iPhone-如何检测切换选项卡视图和BackBarButtonItem? - IPhone - how can i detect switching tab view and BackBarButtonItem? 如何查看带有活动指示器的子视图? - How can I view subview with an activity indicator? 我应该在哪里将子视图添加到UITableViewController中的表视图下? - Where should I add my subview to have it UNDER my table view in a UITableViewController? 将视图添加为子视图时,为什么看不到整个选项卡栏? - Why can't i see my whole tab bar when i add it in a view as subview? 如何为从iPhone导航栏下方滑动的视图设置动画? - How can I animate a view sliding from under the nav bar on iPhone? 如何使用Phonegap在屏幕底部显示本机iPhone标签栏? - How can I have the native iPhone tab bar at the bottom of the screen using Phonegap?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM