Why is view resizing when using a uinavigationcontroller - ios

I initially started making my Viewcontroller without a navigation bar, the view is now how I want it. But now I'm initializing a navigationcontroller with rootviewcontroller of that original viewcontroller and the original view is being pushed down instead of being in the same place...
How can I still use this navigationcontroller without having the original viewcontroller.view being pushed down?
Sorry if this question is a bit off
Thanks!

Related

How to switch between different ViewControllers or NavigationController in Swift?

I just got into Swift programming lately and I have an easy question I can't answer.
I understood that we start putting a ViewController to show something, then if I want to display another view I can use a segue linked to another view. But I don't like the fact that the view called by the segue doesn't take the full screen. It just looks like a pop-up screen.
So, how could I switch from a ViewController to another ViewController or NavigationController or whatever that keep the fullscreen view.
How could I change my view without passing through a segue and get the following view like a pop-up ?
Hope my wonder is clear enough to be answered :D
Thanks a lot to the community !!!
You can make your segue's presentation style as fullscreen. But if you want to use UINavigationController, first you need to embed your ViewController in UINavigationController(rootViewController: ViewController()). After that you can navigate to another ViewController using pushViewController method.
When you use UINavigationController, it will stack on top of each other. When you use popViewController, the current ViewController will be popped off from the stack. That's how works in general.

SplitViewController primaryViewController has no way of being dismissed

I have a UISplitViewController with default behaviour. When showViewController(..) executes, it presents a new UINavigationController that I have passed. Sometimes this UINavigationController is presented modally (based on TraitCollection).
I have noticed that a UINavigationController (or any VC for that matter) is only presented modally when using a horizontally/vertically compact size class. What is missing however is a method of going back or simply dismissing the UINavigationController. (A back button is only visible if the device goes from compact-regular to regular-compact, in which case the UISplitViewController adds a back button to my presented UINavigationController.)
How do I handle this behavior to be as consistent as possible for dismissing this presented UINavigationController? Should I consider not using a UINavigationController for any particular reason? (and embed a ViewController only in certain cases instead?)
Any help appreciated.

Using UITabBar outside of the rootViewController

My application has a sequence of UIViews (with a UINavigationBar) that lead up to a UITabBarController View. These tab bar views should each have UINavigationBars as well. In my research, I have found that due to the nature of UITabBarControllers they should be the rootViewController and that they should not be wrapped in a previous view controller's NavigationBar, as this will lead to problems in the Navigation stack. I've read into seguing from UIView to UITabBarController using the modal method rather than a push, as to to remove the UINavigationBar, but I can't seem to pass data through the TabBarController and NavigationController to the Tab root view through the segue. I get a selector error.
I guess what I'm looking for is advice on a sound approach to take for using a UITabBar where each child view needs NavigationBars and where the UITabBar is segued to from a previous UIView.
Thanks!

Showing UINavigationBar not working

I have a UITabBarController inside of a UINavigationController which originally had the navbar hidden before the view when the tabs were needed, though when I try to show the navbar inside the file nothing happens and if I do it just before the transition then it appears before I have pushed between the two controllers is there a way to stop this effect and make it so that when the next ViewController loads the navbar is on it when it appears?
This is not an OS specific issue as it occurs in iOS 6 and 7
The UITabBarController class is not designed to be used as a child of a UINavigationController, which might explain why you're seeing odd behaviour. If you absolutely need a tab bar within a UINavigationController, you'll probably have to roll your own. Otherwise, make your UITabBarController the window's root view controller and populate it with navigation controllers.
Managed to work it out though gave conmulligan the credit because he gave me the idea which was to keep the navigation bar hidden and to embed the viewcontroller inside a new navigationcontroller so there was a whole new navbar

ViewController to NavigationController and back

I have one problem for which im not sure how to solve. Currently i have main UIViewController with some buttons. This is the initial view that is created with app. On it, one button calls storyboards segue with style Modal on ViewController which is part of UINavigationController. After that few other viewcontrollers are handled within the UINavigationController via segues and getting back via navigationController:popViewControllerAnimated. What i dont know is how to get back from UINavigationController to first UIViewController. I tried, when I'm on first one on navigationctrl,
[self removeFromParentViewController];
yet that only removes the view but it seems that UINavigationController somehow stays alive as result is black screen. Creating unconnected segue and call it from code would be possibility, but im not sure if that is the proper way. Would that leave navigation controller alive ?
Is there any reason you are using a UIViewController first and THEN a UINavigationController?
Why not change this so that the UINavigationController is the initial view controller and then drive everything from there.
If you want the first view to not have a nav bar then you can hide it easily.
That way you can move around through all views by popping and pushing through the UINavigationController.

Resources