Navigation Controller Header is not showing - ios

So, here I basically have this layout
but when I build successfully I am not able to see the title of the navigation controller.
What can I do?

This is what you want to emulate:
Set the UITabBarController as is Initial View Controller
add a relationship to each scene, whether it is a UINavigationController or not
If a scene is a UINavigationController, it will behave like any root navigation controller, with its own view stack, back button, an so forth.
Running the app above, then tapping on Item 2 will present this navigation controller:
If you cannot make the UITabBarController the initial View Controller at launch, you can make it become root later on using this technique:
let newViewController = self.storyboard?.instantiateViewControllerWithIdentifier("id")
as? UIViewController
self.view.window?.rootViewController = newViewController
This will present the architecture above, albeit without animation (nor any way to navigate back). Perfect for onboarding or login screens.
Tested on Xcode 7+, iOS 9+

Make your TabBar Controller the initial view, And make sure to remove the navigation controller that's linked to it, Then it should work fine.

Related

Master Detail Controller is always presented modally since iOS 13

I have a login screen that pushes to a master-detail VC on successful auth.
However the screen following log in is always presented modally, this behavior started since iOS 13 (prior to that, login screen pushed to the initial VC, and another master VC linked VC had the menu)
To demonstrate, I took the final code from RW's master-detail view the tutorial, added a view with a button, linked button's action to master VC with a push segue. After this, even in the storyboard, you can see that the Master VC is presented modally. not pushed.
Attaching source code of modified code which shows what I want to demonstrate this
And a screenshot as well -
From the screen shot you've posted I can see that you don't have a navigation controller embedded to your initial view controller. So when you do a segue from your initial view controller via storyboard it'll present the view controller and presentation will not be fullscreen by default (in iOS 13).
You can change this setting via storyboard as well as in your view controller
In storyboard select your view controller and refer to the screenshot
For more detail refer to this question for full screen presentation
Try to change the kind to Present Modally and after that change the Presentation to Full Screen.
Programatically while presenting , add this code
if #available(iOS 13.0, *) {
nextViewController.modalPresentationStyle = .fullScreen
}

xcode view became modal when connected as segue

I'm pretty new to Swift/xCode and now I'm stuck with a very (for me) strange behaviour. When I connect a button inside a view to perform a segue, the target view became modal.. what I'm doing wrong?
Please take a look to below gif that show the problem and my setup
LoginViewController should be managed by a NavigationController to make it work. If you try to show some view controller without having a NavigationController in the navigation flow, it will appear as a modal. So embed LoginViewController as the RootViewController of a NavigationViewController

Programming Transition Loses Navigation Bar

I'm having an issue with my main.storyboard file. I changed the settings of my app so that the start screen is the main.storyboard file, rather than LaunchScreen.xib. The initial ViewController is the NavigationController, and the second is my SplashScreeViewController. (I created my own splash screen in the storyboard so that I could change it with additional code.) I use a line of code in my splash screen to later transition to the second view controller. Here it is:
var controller:UIViewController = self.storyboard?.instantiateViewControllerWithIdentifier("Second") as! ViewController
controller.modalTransitionStyle = .CrossDissolve
self.presentViewController(controller, animated: true, completion: nil)
For some reason, when I transition to that second ViewController, the navigation bar that should be at the top (of the second ViewController) isn't there, opposite of what was shown in the main.storyboard file. I tried to add an invisible, disabled button to the splash screen as to add a connection between the two view controllers, and therefore adding a navigation bar to the second, but when the splash transitions on its own, no navigation bar appears on the second.
Is there a way I could have a navigation bar on my second view controller without dragging one in, nor programming it in? I would like to use the one Xcode provides when you create a new connection between controllers.
Thanks in advance to all who reply.
*(I apologize for the lack of pictures to help describe my problem. I don't have enough 'reputation' to do so.)
You need to embed your Second view controller on a Navigation Controller, and then instantiate that navigation controller instead.
This might solve the problem - It looks like you are presenting a modal view controller when you probably want to be pushing your view controller from your initial navigation controller with pushViewController

Going from NavigationController to TabBarController

So... I've got a ViewController that's being pushed onto a NavigationController. In interface builder I create a separate ViewController and Embed it into a TabBarController and it looks good in Interface Builder.
In my app, I'm trying to go from one of the ViewControllers in my NavigationView to the ViewController in the TabBarController. How would I do this the correct way? I can't just push the view onto the NavigationController, because the tab bar at the bottom won't show up.
Any help would be greatly appreciate.
I believe you're operating with the UINavigationController and UITabBarController in a backwards order to recommended best-practice.
Unless something has changed in the last year or two (which may have happened) the UINavigationController should never have a UITabBarController pushed onto it. If you are using a UITabBarController in your app, it should be the window.rootViewController, and the navigation controller being member of the UITabBarController's viewControllers array.
I'm trying to go from one of the ViewControllers in my NavigationView
to the ViewController in the TabBarController. How would I do this the
correct way?
In that structure, you'd assign your destination view controller as another element of the viewControllers array. Then, in my style, I'd send a NSNotification something like "LaunchOtherViewController" from your first view controller, and thus you have no need for the first view controller to know about the tab bar controller or second view controller. Then have some class that knows about the second view controller receive that notification, and update the selectedIndex of the UITabBarController to that of the second, destination view controller.
Hope that makes sense.
You need to push the TabBarController onto the view. You may need to set the selected view controller of the tab bar, but it's important the tab bar controller be actually pushed onto the navigation stack (or presented modally).

Using my NavigationController with my ECSlidingViewController

What I'm trying to do
If started creating my App. I've got a NavigationController as my rootViewController. When the app is started it will open my LoginViewController. In there I do the Login-Procedure, if everything is fine. I'll start my ECSlidingViewController. Which has a Menu (UITableView) and a MainView (UITableView).
Until here everything is working fine. I can swipe and it show's my menu. Now the problem is starting. When I press a menu-item it perfectly starts my new ViewController and show's the content. But there it still show's the same NavigationBar - like in the ECSlidingViewController. So I got no possibility to tell the user what he is looking at, also I need to show him sometimes new options in the NavigationBar.
Question
How can I fix this problem? I'd always like to show the NavigationBar of the specific ViewController I'm actually using. If you guy's have some Codesnippets or a good Idea how to handle this problem. Please leave a comment bellow.
If you need codesnippets or something else, tell me I'll upload it! Thank you in advance!
Code
This is how I start my ECSlidingMenu:
[self performSegueWithIdentifier:#"loginPush" sender:self.view];
This is how I'll start a new ViewController:
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
Pictures*
You want to change your structure so that the ECSlidingViewViewController is the root view controller. This can either be from the start of the app or you can switch the root after login. The top view controller of the sliding controller should then be a navigation controller and you should set the root and push other view controllers into that navigation controller.
What you currently have breaks the link between the view controllers and the navigation controller because only the sliding view controller is pushed into the stack and its title (nothing about its navigationItem ever changes).
Probably the easiest solution would be to change the initial view controller in the storyboard (to the sliding view controller). In this case the login view would be presented as the root view of the navigation controller (which would be the top view). Then, after login you push the next view controller and then (after the animation completes) remove the login view controller from the nav stack.

Resources