Add a default view on a navigation view controller - iphone

I have a navigation controller and a tab bar where I have buttons for multiple options. When a button is ever pressed it pushes its respective viewcontroller in navigation controller. That's fine, but when I again press the button in tab bar after loading any other suboption viewcontroller in navigation controller, it shows blank screen instead of that "options screen" which it shows when I touch it first time.
I am using this code:
[self.navigationController pushViewController:accountOptions animated:NO];

You're pushing same view controller twice without ever poping it from navigation controller.
You can either pop view controller when switching to another one or push view controllers once on navigation controller in tab bar and be done with it.

Related

TabBar not showing when moving from viewController to tabBarViewController?

When a go from a viewController to a tabBarViewController (meaning one of the two view controllers that is one of the tabs), the tab bar does not appear. When I move between either of the view controllers that are in the tab Bar controller instead, the tab bar works properly and it appears. Why does the tab bar seem to break when moving between a tab bar view controller and a regular view controller?
Thanks.

How to add the default back button in the navigation view controller from storyboard or in swift?

Okay so I have one main view controller and then I added a navigation view controller from the 'Editor -> Embed In -> Navigation Controller' toolbar and then I segued from the first view controller button to the empty navigation controller scene because if I segued directly to the signup or signin VC the main view controller would end up having a bar on the top like the navigation view controller. But now i added an bar button item "Back" and segued to the main VC and the bar comes back with a builtin back button. So how can i add a default back button or any back button without having the main VC becoming a navigation view controller. Here is a link to an image: https://www.dropbox.com/s/1623a45v846ijn8/Screen%20Shot%202015-09-27%20at%2012.23.26%20PM.png?dl=0
The problem is that you have two navigation controllers when you should only have one.
You should make your initial view controller a UINavigationController, and set your previous initial view controller as the root. If you don't want to see the bar, just set the bar to be hidden on your viewWillAppear, and unhide it on the Sign In / Sign Up pages.

Trying to create a Navigation Bar back button to a Tab Bar Controller view

I have a tab bar controller.
From one of the views i want to goto another view via a button, which i have done.
Once on that page i want to go back using the navigation bar.
This is the problem.
How do i get it to go back to the tab bar controller page?
Thanks
Mat
You can arrange your view controllers as follows:
Tab bar controller
Navigation Controller
View Controller 1 - button to go View Controller 2 using segue
View Controller 2
So, View Controller 2 will have a back button to go to its previous view controller.

Tab controller being pushed by the the navigation controller

I'm new to iphone development. I'm trying to implement a tab view controller and a navigation controller. The problem that I'm having is that the navigation controller is pushing the tab bar view. How can you make the navigation controller slide without pushing the tab bar view? Any ideas?
You need to post your code, however to achieve the effect you are after you need to create an array of Navigation controllers and add them to your TabBar:
myTabBarController.viewControllers = navigationControllerArray;
When you push a view controller the tabBar will remain in place. Equally if you touch a tab then you will switch to the view controller in the array.
You should not push a tabbar view in navigation controller. Rather you should create a tab bar controller and then add navigation controller to it. Doing so will just slide navigation controller not tab bar. You can refer to iPhone SDK documentation for more information.

How can I prevent a view from covering my tab controller in my tab based application?

I have an application with a Tab Bar Controller that has three tabs.
In tab 1 there is a view (view1) with a button that when clicked transitions the user to a new view (view2) still within tab 1. However when this new view (view2) is loaded it covers my tab bar controller.
What is the best approach for me to take to still display tab bar controller as well as keep tab 1 highlighted?
How are you performing your "transition" to view2 from view1?
One solution is to use a UINavigationController as the root view controller for tab1, so view1 can display view2 by pushing it on the navigation controller. Alternatively, have view1 display view2 modally.
Either way should not cover your tab bar, and tab1 will still be selected (highlighted).
I think you are pushing the view as modal view if this is the case then the view will definitely cover your tab bar the other way to do this is push the view controller and this will not hide your tab bar.
Try to do it like:
[[self navigationController] pushViewController:viewContObject animated:YES];
Hope this helps,
Thanks,
Madhup