显示/隐藏标签栏
每个人 我有一个问题,我一直在寻找解决方案,但找不到任何解决方案。我正在开发一个基于标签栏的应用程序。问题是我想在第一个屏幕上隐藏选项卡栏,然后在第一个屏幕之后显示的所有其他屏幕上显示它。 谁能给我这个问题的最佳解决方案?
实际情况是我有一个屏幕是登录屏幕。现在我不想在此处显示选项卡栏,因为仅当用户登录时才会显示选项卡栏。当用户登录时,我希望显示选项卡栏以显示其内容。
此致
Everyone
I have a problem and I have been searching the solution but could not find any. I am working on a tab bar based app. Problem is that I want to hide tab bar at first screen and then show it on all other screens that are being displayed after first screen.
Can anyone please give me the best solution for this problem?
Actual scenario is that I have a screen that is login screen. Now i dont want to show tab bar here as tab bar will be displayed only if the user is signed in. When user logs in, I want the tab bar to be displayed showing its contents.
Best Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您将选项卡栏控制器作为
rootController
,则可以使用rootController.selectedIndex =0
选择第一个选项卡栏项目,并使用rootController.selectedIndex =1;
等等。一旦特定视图加载,您就可以加载数组中的其他视图,然后将其添加到带有动画的
rootController.selectedIndex
和reloadInputViews
中。编辑:(根据评论)
所以你有一个标签栏控制器,并且你想在启动应用程序时显示介绍和登录屏幕。如果登录成功,你想要呈现标签栏控制器!这可以通过
ModalViewControllers
来完成在首先加载的视图的
ViewDidLoad
中(默认情况下这是您的第一个选项卡),添加Now your介绍屏幕将在您的第一个选项卡加载后立即加载标签栏加载。但加载是瞬时的,因此用户的眼睛看不到。现在引用您的登录视图控制器(如
@class LoginController
)并创建一个对象LoginViewController *lvc;
,并合成它。现在声明LoginButton
并在IBAction
中
以及在
LoginViewController
中,如果登录成功,只需执行If you have your Tab Bar Controller as your
rootController
, you can userootController.selectedIndex =0
for selecting 1st Tab bar Item, androotController.selectedIndex =1;
and so forth.As soon as that particular view loads, you can load the other views in an array, and then add it to the
rootController.selectedIndex
andreloadInputViews
with animation.Edit: (as per the comments)
So you have a tab bar controller, and you want to show the introduction and the login screen while starting the App. If login is successful, you want to present the tab bar controller ! This can be done with
ModalViewControllers
In the
ViewDidLoad
of the view that loads up first, (it's your first tab by default), addNow your introduction screen would load as soon as your first tab bar loads. But the loading is instantaneous, so it's not visible to the user's eye. Now reference your Login View Controller like
@class LoginController
and create an objectLoginViewController *lvc;
, and synthesize it. Now declareLoginButton
and in theIBAction
And in the
LoginViewController
, if Login is successful, just do为 uitabbar 创建一个出口,然后声明它隐藏在第一个屏幕中,然后创建一个新的 void,未发送,因此它在第一个屏幕中不起作用,让它说,可以说,隐藏。在 hide 里面,输入代码说你的 uitabbar.hidden = YES;然后,要使其在另一个视图中工作,请在 viewDidLoad 中编写以下内容:
create an outlet for the uitabbar, then declare it hidden in the first screen, then create a new void, NOT SENT SO IT DOESNT WORK in the first screen, make it say, lets say, hide. And inside hide, put code saying your uitabbar.hidden = YES; then, to make it work in the other view, write this in the viewDidLoad: