I have a logout button in a viewcontroller that I have a tabbarmenu, when I press logout I can logout but my tabbarMenu is come to my navigation View controller,
would you please help me to fixed this problem, Thanks in advance,
I think you mean that you are in a tab bar controller, and when you log out you want to navigate to your loginViewController. This is happening, but your tab bars are still visible, and you want your tab bars to disappear as you have logged out.
The reason that the tab bars are still visible is because you are not navigating away from your tabBarController. You are navigating inside one of the tabs to a new loginController.
If my interpretation of your question is roughly correct, you will find the answer here:
How to handle UINavigationControllers and UITabBarControllers iOS 6.1
It shows how to deal with a loginscreen -> tab bar controller, with a logout button on each screen which will properly return you to your loginscreen (note - it doesn't create a new login screen, as you are doing here, it more correctly navigates you back to the original login screen).
Related
I am making an app which requires a use of a UITabBarController along with UINavigationController. I have made the following flow in storyboard.
See image
Now the first question is that is this accepted by Apple, as there are too many discussions for the same.
The other matter of concern is that is it possible to eliminate any UINavigationController and still get the same flow of the app? The main thing required is to have the SAME tab bar and navigation bar on all sub tabs of the tabs. One point to be noted is that if I remove the second UINavigationController then my app navigates directly from sub tab to home view controller on clicking back button.
I have been stuck on this since hours now. I am new to iOS app development and have never uploaded any app to the app store. Any help would greatly valued.
EDIT :
I put the second navigation controller as shown in the answers - see this flow, But because I have a navigation controller before the HomeViewController, so I am getting a navigation bar at the top and then some empty space below that(exactly equal to the top navigation bar) and then the page contents on runtime. Any solution to this?
Yes, it is acceptable by Apple.
But View hierarchy is not managed correctly. In your case Tab bar will be the root view controller for 2nd navigation controller.
Also, Tab and sub tab you are pushing will be part of 2nd navigation controller.
That's the reason you are getting back on Home view controller.
It's good practice to keep navigation controller to each Tab to manage it's sub-tab hierarchy.
You could present tab bar controller or setviewcontroller from Home View controller.
First embed tab bar controller as in this image and the embed navigation bar controller as in this image finally this will look like
In my previous question, i asked about including a log in page with my SWRevealController slide out menu before moving onto a home page. The solution was the following set up:
However, i need a navigation bar in order to house the button to open the menu (the navigation bar wont cover the status bar). When i insert a NavigationController in the following way, the menu no longer works
Why does this happen?
Put your Navigation Controller before Login/Signup Controller, then in viewWillAppear of Login/Signup Controller, hide the navigation bar
I looked at the following two resources: Tab bar disappears after segue and My Tab bar controller disappears after a push segue. However, both of them are in Objective-C and they don't seem to address the issue that I am having.
Here is my Main Story Board:
Zoomed in is:
Now, let's call the view controller that has Sign Up and Log In VC1 and the one with the Facebook button, VC2. When I go to VC1 from the Tab Bar Controller, everything is good. I have the tab bar on the bottom of my VC1. And I tap Sign Up and the tab bar is gone. Which I want. And when I go back to VC1 (there is a navigation bar on VC2 with the button cancel that I programmatically added in, and when clicked on, takes me to VC1), the tab bar is gone. But I want the tab bar there.
Some people have suggested me to use a navigation controller. But I do not want to use it because I don't want the tab bar to appear when the user clicks on Sign Up. And, the navigation controller only allows for right to left and left to right segues and I want custom segues (I tried customizing the segues for a navigation controller and it caused a crash for me).
So my question is, does anybody know how to keep the tab bar on VC1 AFTER going to another View Controller WITHOUT a tab bar, and going back to VC1 WITH the tab bar?
Sorry for the long post.
I'm creating an application where I need to use two different navigation bars. When the application first opens up, the nav1 bar should be displayed with an image and a Login button .. when they login screen appears, there is no nav bar. After login, it goes to a Detail screen where I need to show a back arrow image, a screen title and a menu button with drop down options.
I'm using one View_Controller that all my Views inherit from. I've been working on this for days and I'm so lost, please help.
I'm a little confused about the structure of your app.
As I understand it, you want an initial view that is contained in a UINavigationController. Once someone taps the "Login" UIBarButtonItem on the UINavigationBar, then you have a view come up that is not contained in a UINavigationController (probably because it is a modal view that is outside the navigation flow of your app).
The part I'm confused about is where the Detail view comes in. Is the modally presented view dismissed while the Details view is pushed onto the navigation stack from the initial view? Why does the Details view need a back button? Does going back to the initial view effectively log out the user?
At any rate, you should be able to change the UINavigationBar for every view that is pushed on to the stack (that is also contained in your UINavigationController). If you are using Storyboard, you need to make sure that you embed the views pushed on to the stack in a UINavigationController. You can do that by going to the "Editor" menu, selecting "Embed in" and then selecting "Navigation Controller".
Let me know if I didn't understand your question or if you can post more details.
Navigation bar will be the same in the app. You can hide it, show it, change title, change background color, or background image on each view depending on your requirements. But there is only one navigation bar in navigation based apps.
I'm new to iOS developing, I wanted to ask could someone help me how to make a page control(screen sliding) with navigation bar, I have tried a lot of things, I googled a lot but I couldn't find a solution.
I have a button when I click it will open a pagecontrol(rootview for screen sliding) with tableview which will change its data according to pages.
the problem is when I click that button I don't know how to get back to main page.
Can anyone help me?
This is a good tutorial for learning how to create a page controller.
As far as your other problem of getting back to the main page, if you add a bar button item to the root view controller's navigation bar, control-drag to your second view in your storyboard from that bar button item, a "Back" button will automatically appear in the upper left-hand corner of your second view controller.
Hope it helps!