My app flow requires Navigation and TabBar controller. So I decided to use TabBar template. Since my first page is login which do not require TabBar, I used presentModelViewController to show Login screen which have Navigation bar if user Navigate to Forgot password.
LoginView *rootView = [[[LoginView alloc] init] autoreleas开发者_开发问答e];
navigationController= [[[UINavigationController alloc] initWithRootViewController:rootView] autorelease];
[tabBarController presentModalViewController:navigationController animated:FALSE];
Ones the user login I dismiss view controller and show TabBar with 5 Tab and Each Tab contain TabaleView. User select any row and navigate to sub view.
The issue is, on sub view I dont need tab bar. (TabBar is needed ONLY on dashboard). If I hide tabBar a white space remain there. Is there any workaround to solve this issue?
On subview write this mehthod:
Subview.m:
- (BOOL)hidesBottomBarWhenPushed{ return TRUE; }
and in Subview.h
- (BOOL)hidesBottomBarWhenPushed;
thats it, it has resolved the issue.
Put this method into your subview, where do you want hide the tababr.
Try this one.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
}
self.hidesBottomBarWhenPushed = YES;
return self;
}
Best of Luck.
You need to use this method when you are pushing the viewController of your subview.
[viewController setHidesBottomBarWhenPushed:YES];
Hope this helps.
精彩评论