UINavigationBar disappears when performing segue - ios

I encountered a problem in my app.
I have to have a UINavigationBar in all my pages, and so I created a UINavigationController 'embed in' with my first page. So the UINavigationBar appears on it, but when I perform a segue from that first page (by instating a new view controller and presenting it) the navigation bar doesn't appear on the second view controller.

Check your segue is presenting or pushing a second page.
Check out segue properties, If it's presenting by selection of 'Modal' on segue property of attribute inspector. On presenting view controller you won't get your Navigation bar.
You will get Navigation bar when you push a segue.
And If you want presenting animation on push using segue, You can go for custom segue.
Here is the link.
http://www.appcoda.com/custom-segue-animations/

Related

SWRevealViewController switching between ViewControllers

I have a problem with SWRevealViewController. In my app I have a long chain of UIViewControllers connected to a single UINavigationController. After adding a side menu and setting the "reveal view controller push controller" segue for cells I see only ViewControllers connected with a segue. I can't move between my UIViewControllers in the chain any more. And navigation bar is missing. Is it possible to use a side bar and UINavigationBar at the same time?
I see your image I think you have to add another navigation controller before the C****** S****** View Controller or the view controller you want to go
the reason is that there is no UINavigationController before the C****** S****** View Controller and that's why Navigation bar is hidden and you can't move

Navigation Controller doesn't appear on Dashboard ViewController

I am using a Navigation Controller in Xcode8, the navigation bar doesn't appear on the following View Controller on the Dashboard. They will appear on the simulator and on the ViewController topDown tree, but nothing on the view of the dashboard.
Navigation Controller Screenshot
Its'a strange problem, It always happen to me too. You can change your segue type to deprecated Push to see nav bar, after that you can change again.
When you connect your navigation controller to the view controller it happens, because it creates segue type to Show. When you change the segue type to Push segue, you can see the Nav Bar on your View Controller.
Just click the segue, you should see the segue options on the right like the picture.
The problem was the segue before the Navigation Controller. When I delete it, all the Navigation Bar come back. Don't know why, but if the problem happen, you just have to delete this segue and then with Ctrl+Z, the segue come back and the nav bar stay

Unwind segue and nav button items not triggering after tab bar controller added

I'm trying to implement an unwind segue that will take me from the last view controller back to the todo-list controller.
Here's my storyboard
Without the tab bar controller, the unwind segue works fine. However, as soon as I add the tab bar controller, the unwind stopped triggering.
What am I doing wrong?
Thanks
Edit: Also, actions created on the bar button in the last view controller do not trigger when the tab bar controller is implemented
I have had a similar situation and I was able to resolve it by setting the Modal segue to "Presentation: Current Context" instead of "Default" in the Attributes Inspector (screenshot here: https://cloudup.com/cHFyH8OOY9D).
That is, the segue arrow between the Table View and the second Navigation Controller in your screenshot above.
I've had a similar issue with unwind segues not being called with view controllers within a TabBarController.
The solution is to create a custom TabBarController class, and have the unwind segue action in that class. You will then be able to pass a message to the current tab bar view controller.

Push segue from a view controller controlled by UITabBarController

Let's assume that a first view controller is connected with a UITabBarController and I want to make a push segue to the second view controller from this first view controller.
From my googling, it seems that a modal segue from a view controller connected with a UITabBarController hides the bottom tab bar, while a push segue doesn't.
However, my push segue is also hiding my tab bar in the second view controller. I have overridden prepareForSegue method in the first view controller.
Below are images of my storybard and the simulator. Anyone has an idea why this is the case? Thank you in advance for your helps.
Your trouble is because your tabViewController is embedded in the navigation stack that you initialise with your login screen.
you need to rearrange things so that each of your tab bar controller tabs opens to a new navigation stack.
What I suggest
your loginscreen should navigate to your tab bar controller with a modal/presenting segue, not a push segue. Remove the navController that encloses the loginscreen, you don't need it (well, even if you keep it, don't use a push segue, use a modal segue, and you won't then be referring back to that navController's viewController stack from inside your tab bar).
embed each of the first viewControllers in your tabViewCOntroller inside a separate navController.
Now you can push segue within your tabViewController's tabs.

What is the difference between Modal and Push segue in Storyboards?

Can someone explain to me what is the exact difference between modal and push segue?
I know that when we use push the segue gets added to a stack, so when we keep using push it keeps occupying memory?
Can someone please show me how these two are implemented?
Modal segues can be created by simply ctrl-click and dragging to destination but when I do that with the push my app crashes.
I am pushing from a button to a UINavigationController that has a UIViewController.
A push Segue is adding another VC to the navigation stack. This assumes that VC that originates the push is part of the same navigation controller that the VC that is being added to the stack belongs to. Memory management is not an issue with navigation controllers and a deep stack. As long as you are taking care of objects you might be passing from one VC to another, the runtime will take care of the navigation stack. See the image for a visual indication:
A modal Segue is just one VC presenting another VC modally. The VCs don't have to be part of a navigation controller and the VC being presented modally is generally considered to be a "child" of the presenting (parent) VC. The modally presented VC is usually sans any navigation bars or tab bars. The presenting VC is also responsible for dismissing the modal VC it created and presented.
Swift 3.0 and XCode 8.2.1 update
1. Push Segue
Push segue has been renamed as Show segue. To create push segue, the parent view controller needs to be embedded in navigation controller. The navigation controller provides navigation bar. Once you connect two view controller with push segue, the child view controller will automatically has navigation bar on top. The child view controller will be added on top of the navigation stack.
Push segue also provides default features. The child view controller will have a back button that gets you back to the parent view controller. You can also swipe right to pop the child view controller. The animation for push segue is like sliding pages horizontally.
While you are allowed to make a push segue from a view controller that is not in a navigation controller, you will lose all the features like navigation bar, animation, gesture etc when you do so. In this case, you should embed your parent view controller inside navigation view controller first and then make push segue to child view controllers.
2. Modal Segue
A modal segue (i.e. present modally), on the other hand, is presenting over the current view controller. The child view controller will not inherit navigation view controller so the navigation bar will be lost if you present modal segue from a view controller with navigation view controller. You have to embed the child view controller in navigation controller again and start a brand new navigation stack if you want it back. If you want to get back to parent view controller, you have to implement this by yourself and call dismiss from code.
Animation for modal segue is that the child view controller will comes up from the bottom of the page. The navigation view controller is also gone in this demo
The push view must be built in a navigationController.
Click on your master view, then in the menu bar choose:
EDITOR->embed in->navigationController
This is pushing controls using custom push and segue methods for storyboard
And Modal is way to navigate through views without using Storyboards.

Resources