It is possible to add TabBarController to a subview? - iphone

I am developing a new application. In my application it required firstly signing and registration page. After that it will show tab bar controller. So is it possible to add tabBarController in thirdView without using presentModelViewController?

You normally create your UITabBarController, fill in the desired viewcontrollers
for example you have a UITabBarController called tabBar
you can add tabBar.view to any UIView
[self.view addSubView:tabBar.view];

Related

Pushing UINavigationController into UIViewController Using Storyboard

My app's storyboard is using UIViewController's to go to different views of the app. However, I want to try a third party library, that is EGOPhotoViewer, not to reinvent the wheel. But how do I add UINavigationController to UIViewController from the storyboard? Here is the code this library is using to initialize.
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
[self.navigationController pushViewController:photoController animated:YES]
It only works for me when I add it as a view controller:
[self presentModalViewController:photoController animated:YES];
but the library works best within navigation controller because title bars and navigation buttons are missing from my testing approach.
In the storyboard
select your original viewController, then in the menu:
Editor -> embed in -> Navigation Controller (that viewController becomes the rootViewController)
Now you have various options to push your photoController eg:
From a UI widget in your rootViewController, CTRL-drag to photoController. That will create a segue which should work without extra code (although it helps to name the segue so that you can refer to it later in code)
or in code as you have in the question.

Pushing Tabbarcontroller from a UIViewController

i`m wondering if its possible to push a TabbarController from UIViewController ?
what i want to do is:
when the user opens the app it shows a View with two buttons to select the language he want, this view does not contain anything except the two buttons, no tab bar, no navigation bar.
after selecting the preferred language it should push a tab bar view with 5 tabs in it. each tab contain a tableview controller.
is it possible ? if yes please explain how to do it i`m little bit new for this :)
thank you in advance :)
Well you can add it as subview to UIWindow of your app delegate. You have to make a property UIWindow of your AppDelegate class.
Now When in your UIViewController button is pressed, do something like this:
- (void) buttonPressed:(id)sender{
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
UITabBarController *tab = [UITabBarController youWayOfInitializingIt];
[delegate.window addSubview: tab.view];
}
Sure, just present an UITabBarController from the UIViewController using presentModalViewController.
I would try dragging out two different tab bar view controllers, one for each of your languages. Ctrl-drag each button on your UIViewController to its respective language's tab bar view controller and choose the type of transition you want. However, if you want to use the push transition I suggest embedding the original UIViewController in a navigation controller. You can do this by clicking on the UIViewController and then...
Editor --> Embed in ---> Navigation Controller
This will provide you with a navigation bar and a back button if the user wants to go back and change the language.

Add a UIView before UINavigation

I have created a navigation based application.
I need to add a UIView before the navigation with the company details and have user to click on a button to enter the UINavigation view.
How can i do that?
Thanks.
Make the UINavigation's viewdidload show a modal viewcontroller, and give the viewcontroller a button to dismiss it.
You can add that UIView directly to the UIWindow, i.e. [self.window addSubview:self.myView]; and as you done with that UIView(after clicking on button), simply remove it from UIWindow and add UINavigationView to UIWindow.

Navigating between views using Toolbar

In my app, I require the main page to contain a toolbar at the top of the view. This view has a tableView. So my application cannot have a NavigationController.
Problem
When I want to navigate to the other view on click of the tableview cell then I am using the "pushViewController:animated:" method but it doesnt seem to work.
I checked the connections in IB. They are fine.
How can I navigate between pages without navigation controller??
I do not want to use the modal view for other views.
Please Suggest some Method.
You can use an instance of UINavigationController without having it displayed and using it for navigation.
Load your first view controller with your instance of UINavigationController in your appDelegate implementation.
Like:
FirstScreenController *fsc=[[FirstScreenController alloc]initWithNibName:#"FirstScreenController" bundle:nil];
UINavigationController *navigation=[[UINavigationController alloc]initWithRootViewController:fsc];
navigation.navigationBar.hidden=YES;
[window addSubview:navigation.view];
Here FirstScreenController can be your view controller having the toolbar and tableview.If you want to display another view on any click of the tableviewcell, call it this way.
[self.navigationController pushViewController:secondviewcontroller animated:NO];

Adding a UITabBarController to an UIViewController

I've got a sample application on http://github.com/niklassaers/Test-iPhone-TabBar-App that shows my problem: I have a regular view-based application, and at some point (in this case when I click a button) I want to load a tabbar controller and display it. I believe this is what I should be doing:
MyTabBarController *tabs = [[MyTabBarController alloc] initWithNibName:#"TabBar" bundle:nil];
[self.view addSubview:tabs.view];
Unfortunately, this brings up a bit of black in the bottom of my main view and nothing more. I believed it should bring up the tabbar, the tabs, and the selected view. What is the correct way of loading a TabBarController (or making a TabBar controller if that's what I've done wrong) in a view-based application?
Cheers
Nik
You should use a UINavigationController, then just push the tabs controller onto the nav controller when you're ready to display it.