Reputation: 407
In my Application first i have some Login View Controller,after login with button action am moving to Tabbar Controller with Four tabs. my problem is i need to quit that tabbar controller when i click on barbutton and need to come to that loginViewController.please anybody help me in this.actually i have tried some methods but i dint get that. Thanks in Advance for Valuable Solution to problem.
Upvotes: 0
Views: 427
Reputation: 407
AppDelegate *delegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
[delegate.tabBarController.view removeFromSuperview];
[delegate.window addSubview:delegate.loginViewController.view];
i got solution for my problem with this code. hope this will help for someone.
thanks for all answers.
Upvotes: 0
Reputation: 637
Add your tabBar controller to [appdelegte window] first and then present Login View Controller on it. When user log-ins successfully, dismiss Login View Controller. Again when you click on barbutton to come to that loginViewController , present Login View Controller on tabBar controller. In this case there is no need to add and remove tabBar again and again.
Upvotes: 0
Reputation: 31081
In appDelegate place your tabBar and in side loginView ,add this tabBar
TUTAppDelegate *appdelegte =(TUTAppDelegate*)[[UIApplication sharedApplication]delegate];
[[appdelegte window]addSubview:[[appdelegte motivationalTabBar]view]];
On button press remove TabBar
TUTAppDelegate *appDelegate = (TUTAppDelegate *)[[UIApplication sharedApplication] delegate];
[[[appDelegate motivationalTabBar] view]removeFromSuperview]
Upvotes: 1