How to push the uinavigationcontroller into another uinavigationcontroller - iphone

Currently i have an application that uses uinavigationcontroller but hides the navigationbar only in root view and i want to use this application as external library in some application and push this entire application as one menu item.
But when i try to push this application in navigation stack it hides the navigation barand i am not able come to my previous list.
How to show the back button in this case and How to push one uinavigationcontroller in some other navigationcontroller?
please help me in this issue.

The navigationController is applicable throughout the application.So,what u need to do is simply hide the navigation bvar in RootViewController and show it on the next view.This solves your problem.

Related

How to structure controllers using swift?

I want to build an app using swift with the following structure:
Login/Signup screen
Home screen with slide out menu on the left
Different Pages in the menu -> same level like home screen
![Picture of the structure][1]
// Sorry not enough reputation for posting images
Here is an example, but I don't understand it.
GitHub-Link
![Picture of the controller structure][2]
Why is the Login-Screen the rootViewController of the Navigation Controller?
Why is there no "back" button on the other controllers of the menu (Friends, Profile)?
I could remove the segue from Login to Profil and the app still works fine...it's a normal push segue. I don't understand what that sequel does.
I thought every controller which is not the rootviewcontroller of the navigation controller gets pushed on the stack and a "back" button...
Should i split the Login and the Signup screen into two different controllers?
My suggestion:
1. Login screen/Signupscreen
=> Modal segue to navigation controller
2. Navigation Controller => RootViewController: Page 1
But how should I implement the Page 2, Page 3,... at the same hierarchical level as Page 1
How would you structure the controllers?
[1]: http:// i.imgur.com/qHMy6zs.png
[2]: http:// i.imgur.com/wdOGCGa.png
Looking forward to your answers!
Jan
Why is the Login-Screen the rootViewController of the Navigation Controller?
It does not have to be, it's a design decision, personally I would not do it that way.
Why is there now "back" button on the other controllers of the menu (Friends, Profile)?
Pushing a view controller onto a UINavigationController will do this automatically unless you specify that the back button should not be present in the view controller that gets pushed. UIViewControllers have a property called UINavigationItem where you can set the back button to hidden. See here.
I thought every controller which is not the rootviewcontroller of the navigation controller gets pushed on the stack and a "back" button...
Yes that's right, you sort of just answered one of your previous questions.
Should i split the Login and the Signup screen into two different controllers?
Yes that would generally be a good idea. Have a separate view and view controller for each of them. It does depend on your ui design also.
How would you structure the controllers?
It appears you have multiple menus and different sections to your app. In that case using a UITabBarController combined with multiple UINavigationControllers (one navigation controller per tab) may be one way to go about it, I've used this technique before and it works well.
If I a mistaken based on your images and you actually just have one main menu then stick to just one UINavigationController and just push and pop view controllers, have one view controller / view per view/page of your app.
Best thing is to read up about UINavigationController and UITabBarController and decide what suits how you want to layout your views / your design.

iPhone TabBar Controller Usage

I want make a typical tabbar based application.
And I want to insert login view on startup before main tabbar is shown.
I tried to insert TabbarController in main view, but cannot find appropriate code. All sample code I found is insert TabbarController on startup. (in Delegate file)
My fellow suggest create toolbar on startup but hide it at login view, but I am not sure if this is a general method or not.
In this case, what is a 'recommanded' handling method of TabbarController ?
A simple solution would be to
1-Add the tab bar to UIWindow in the appDelegate as is suggested by apple.
2-then add a UINavigationController in tabbar using tabbarController.viewControllers=[NSArray arrayWithObject:yourNavController];
3- Now after alloc init on your login controller write this code before pushing it to the navigation controller of the tabbar
yourLoginController.hidesBottomBarWhenPushed=true;
4- push yourloginViewController to the navigation controller of the tabbar.
5- After authentication before pushing your MainviewController instance on the navigation set it like this
MainviewController .hidesBottomBarWhenPushed=false;
I hope these five simple steps will do the magic for you cheers :)
Please let me know if it helps you.Thanks
The approach I use for login screens which works great is:
prepare and show the regular main screen (tab bar controller with whatever initial VC you want to use)
immediately present the login screen modally (without animation) from the tab bar controller (which will obscure the tab bar controller, which is what you want)
make the login screen the startup image

Unhide tabbar when a new view is pushed

I have UITableViewController embeded in a UINavigationController in my app. When a row is selected it pushes a UITabBarController. So far so good. The problem is that some of the tabs I push more views but the tab bar gets hiden. I've tried setting hidesBottomBarWhenPushed = NO, but it doesn't work.
I'm using XCode 4 with storyboard
Any ideas?
I've had this problem in one of my apps (though it was in iOS 4.x, using nibs not storyboard).
What I did to solve it: You want to have the root controller for each tab (the one with tabitem, etc) be a navigation controller - and when you push new views onto this navstack, they will respect the top navigation bar and bottom tab bar (they may actually display two navbars, so you have to be careful, but generally this is the way to go.)
first of all you might want to take a look at this
viewController: The view controller that is pushed onto the stack. It
cannot be an instance of tab bar controller.
so pushing an instance of tab bar controller is not recommended. There's a good reference there that might accomplish the task you wanted ill just provide the link here

Implement UItabbarController + UInavigationBar in project

I have navigation controller based project. In my project I have Splash Screen & Login Screen where i have hidden the navigation controller.
Now i have to implement TabbarController in the application and It need to be shown the screen after Login Page.
I want to add it in AppDelegate.But my problem is that I have set rootviewcontroller of Window as navigation controller.
And Now i want to use Tabbar controller also into the Appdelegate class.
I am finding difficulty into it.
Any help will be appreciated a lot.
What you can do is set the rootviewcontroller as a tabbarcontroller and add a tab for your login screen but make sure to hide the tabbar initially, after the user login, you can remove the tab programatically and show the tabbar.
Maybe you really need that kind of navigation in your application, to me it sounds a bit of a unnecessary workaround and against guidelines. Try having a look at Apple's ("View Controller Programming Guide > Combined View Controller Interfaces") and maybe you'll find a more elegant solution to your problem.

One UINavigationcontroller for the whole app?

i´ve created a UINavigationController in my appdelegate and initialized it with my "modelselectionViewController". This VC has different uibuttons and when touched, a new VC ("modelViewController") is pushed on the navigationstack.
This "modelViewController" acts as my template view and has a uitabbarcontroller with different tabs. The first VC is shown immediately but any changes on the navigationcontroller doesn´t work. I would like to set the name of the title but that navigationcontroller is null.
NSLog(#"navi: %#",
self.navigationController);
If i change my code to push the different VC when touching the different tabs, navigation works but only with a third level of navigation hierachy.
I want to know if it´s possible to use only one navigationcontroller for all my different tabs. Hope i made my setup clear. Appreciate all your help. thanks
I think you might want to read Combining ViewControllers.
In general, you should have the tabbar controller as a 'root' controller, not as a 'child' controller. A quick search in Apple's doc didn't yield a formal 'forbidden', but it might be.
If you create a UITabBarController from a view that's managed in a UINavigationController (ie: if you create a navigationcontroller first, and it's still around when you create the tabbarcontroller), you're starting a fight with the frameworks. Here's the admonishment from the docs on combining viewcontroller interfaces:
An application that uses a tab bar
controller can also use navigation
controllers in one or more tabs. When
combining these two types of view
controller in the same user interface,
the tab bar controller always acts as
the wrapper for the navigation
controllers. You never want to push a
tab bar controller onto the navigation
stack of a navigation controller.
Doing so creates an unusual situation
whereby the tab bar appears only while
a specific view controller is at the
top of the navigation stack. Tab bars
are designed to be persistent, and so
this transient approach can be
confusing to users.
I read that as "if it doesn't break something that we haven't thought of on the next update, we might reject the app anyway because it's 'confusing to users.'"
I suppose you could kill the whole navigation hierarchy and the navigationcontroller if you don't need to return there (like if you just used it for a one-time setup screen). Or you can look into other options for navigating within a viewcontroller that's managed by the navigationcontroller.
One thing to try might be to navigate to a UITableView, and use its cells to push a modal view onto the navigation stack. That would be familiar to users and also jive with the intent of the navigation classes.