Iphone 导航时选项卡栏隐藏
我在我的项目中有四个选项卡默认情况下,第一个选项卡被选中,这是主类,当用户通过选择任何选项卡导航到任何其他类时,我必须检查时间,如果用户在我的应用程序中登录,那么他将导航到他选择的类,否则他将移动到登录屏幕Iphone 导航时选项卡栏隐藏,iphone,ios,xcode,uitabbarcontroller,Iphone,Ios,Xcode,Uitabbarcontroller,我在我的项目中有四个选项卡默认情况下,第一个选项卡被选中,这是主类,当用户通过选择任何选项卡导航到任何其他类时,我必须检查时间,如果用户在我的应用程序中登录,那么他将导航到他选择的类,否则他将移动到登录屏幕 if(appDelegate.sessionId==0) { Login *objLogin=[[[Login alloc] initWithNibName:@"Login" bundle:nil] autorelease];
if(appDelegate.sessionId==0)
{
Login *objLogin=[[[Login alloc] initWithNibName:@"Login" bundle:nil] autorelease];
[self.navigationController pushViewController:objLogin animated:YES];
}
else
{
CreatePoll *objLogin=[[[CreatePoll alloc] initWithNibName:@"CreatePoll" bundle:nil] autorelease];
[self.navigationController pushViewController:objLogin animated:YES];
}
}
如果我导航到登录屏幕,我的选项卡栏会隐藏,当我调试代码时,我知道CreatePoll类也会在后台被调用,我选中此项以显示隐藏但无法成功的选项卡栏。请帮助我,伙计们,我最近三天一直被这个问题困扰着。
在登录屏幕中看不到我的选项卡栏。请帮助只需在
视图中编写此代码将出现:
方法来隐藏和显示uitabar
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
[appDelegate.tabBarController.tabBar setHidden:NO];
更新:
在AppDelegate.m
文件中发布这些方法,并在此时显示和隐藏选项卡栏时创建AppDelegate对象并调用此方法
- (void) hideTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x,view.frame.origin.y, 320, 436)];
}
}
[UIView commitAnimations];
}
- (void) showTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, height)];
}
}
[UIView commitAnimations];
}
只需在
视图中编写此代码就会出现:
方法来隐藏和显示uitabar
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
[appDelegate.tabBarController.tabBar setHidden:NO];
更新:
在AppDelegate.m
文件中发布这些方法,并在此时显示和隐藏选项卡栏时创建AppDelegate对象并调用此方法
- (void) hideTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x,view.frame.origin.y, 320, 436)];
}
}
[UIView commitAnimations];
}
- (void) showTabBar:(UITabBarController *) tabbarcontroller {
int height = 480;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
for(UIView *view in tabbarcontroller.view.subviews) {
if([view isKindOfClass:[UITabBar class]]) {
[view setFrame:CGRectMake(view.frame.origin.x, height, view.frame.size.width, view.frame.size.height)];
}
else {
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, height)];
}
}
[UIView commitAnimations];
}
你想要什么??你想在loginscreen上显示选项卡栏,然后看到下面的“我的代码我编辑它,没有隐藏属性”你想要什么??你想在loginscreen上显示tabbar?然后查看下面的“我的代码”我编辑它时没有隐藏属性我想你在AppDelegate中将LoginViewController设置为RootViewController,然后如果用户登录成功,那么你可以从delegate中添加tabbar我想你可以这样做,只需选中此项并发布didFinishLaunchingWithOptions方法AppDelegate mate..我已经在根视图控制器中设置了我的主视图控制器,如果用户当时选择了任何选项卡,我必须检查用户是否登录,如果没有,则移动到登录屏幕或移动到所选屏幕Oh ok mate这里您将LoginViewController设置为父视图或根视图控制器,因此这里只显示Loginscreen而不是set作为父级或根视图控制器。。只需在推送或显示登录的地方发布代码即可。请选择哦,对不起,伙计。。但有些方法。。就像在viewDidLoad或ViewWillDisplay中登录类的某个地方隐藏底部栏或选项卡栏匹配???(void)ViewWillDisplay:(BOOL)动画{appDelegate.tabbar.tabbar.hidden=NO;}我想你在AppDelegate中将LoginViewController设置为RootViewController,然后如果用户登录成功,那么你可以从delegate中添加tabbar。我想你可以这样做,只需检查一下,并发布AppDelegate mate的didFinishLaunchingWithOptions方法。如果用户选择任何选项卡,我现在已经在RootView Controller中设置了我的主视图控制器我必须检查用户是否登录的时间如果不是,则移动到登录屏幕或移动到所选屏幕哦,好的,伙计,这里您将LoginViewController设置为parentView或RootViewController,因此这里只显示Loginscreen而不是设置为parentView或RootViewController。。只需在推送或显示登录的地方发布代码即可。请选择哦,对不起,伙计。。但有些方法。。就像在viewDidLoad或ViewWillDisplay中登录类的某个地方隐藏底部栏或选项卡栏匹配???(void)ViewWillDisplay:(BOOL)动画{appDelegate.tabbar.tabbar.hidden=NO;}