Dismiss view controller, go to tab-bar view - iphone

I have 4 pages on startup. They are all view controllers. I also have a tab-bar controller with 4 views/tabbar-items. I want a button on the 4 view controller pages that links to the correct tab-bar view. For example, if I am on the third view controller, I want to get to the third view in the tab-bar.
I've tried to use the
[((UITabBarController *)(self.parentViewController))setSelectedIndex:index];
method. But it doesn't work.
Any suggestions?

Related

How to make a login page view xcode navigation and tabbar controller push pop views

I've tried many different ways but can't get it to work. How can I make a simple login/logout view/app? I need the initial page to be a regular UITableView, once login button is pressed it should (push/addsubview ?) to a new UITabBarView (with 2 UITableViews in that), on the second tab exists a logout button, which should send you back to initial login page, also on the login page the nav controller and tabbar should never show up, (but I think I can figure that out). I tried pushing and popping viewcontrollers put that's getting messy. Xcode 4.1
Examples or help will keep me from pulling the little hair I have left out!
Thank You!
I 've wrote some thing, may be it took complex to understand by you but i've tried to explain, main theme is that to make a navigation controller and set it to app delegate window's root view controller then push login view controller to it, and then pushing tabbar controller, read below some explanation.
this is mostly done by making a navigation controller and setting it the app delegate window's root view controller, then make a view controller that is your login view and setting it the root view controller to app delegate's navigation controller, then make a tabbar controller (a view controller) which contains tabbar and navigation controllers on each tabbaritem, and furhter each navigation controller has a reference to tabbar controller(the view controller pushed at login time). So, whenever logins is pressed, it pushes the tabbarcontroller and performs tasks. and when you want to logout, just pop to root view controller of the referenc's navigation controller which in fact is the login view controller.
You can hide tabbar, then show it after login success.
https://github.com/idevsoftware/Cocoa-Touch-Additions/tree/master/UITabBarController_setHidden

Calling popToRootViewControllerAnimated from a modal

I have a modal that I am calling presentModalViewController to display from a custom menubar. This menubar is overlaying a viewcontroller that is pushed from a tableView cell.
Now... that all being said, I need to find some way to jump the user back to the root of the tableView from the modal screen. Is this possible? I've been fighting with this for the past couple of hours with no results.
If you're starting from a tablview, drilling down to a detail view via a navigation controller, and then presenting a modal view controller on top of that detail view, you'd have two steps to get back to your list/tableview: First you'd dismiss your modal view controller, then you'd pop your detail view off your navigation stack.
That should put you back where you started (at the tablview), if I'm reading this correctly.
You could pass a reference to the navigation controller to the modal view, and then immediately after calling dismissModalViewControllerAnimated, you can use the reference to the navigationController to pop back to the root view controller.

Why i can not push a view controller in my navigationController?

In my navigation based application, first view is sign in or signup view. After that i am using a view which is using tab view controller. That view has three tab items. Now i want to create a new view and push in navigationController. But its not working. But adding new view as subView in tabBarController View works. I want navigation for subViews for each tabBarItem? How can i do that?
See this
In your case just create three items and make them all UINavigationControllers like the first tab item in the above example.

UITabBarControllers and UINavigationControllers

Problem
I have an app with a UITabBarController and four different tabs. Three of these tabs are tables which you can click on each row and it would take you to another view.
Question
How would I implement that in terms of navigation? Should I create a UITabBarController with Navigation Controllers as tabs (as shown in image 1) or with View Controllers as tabs (as shown in image 2) with each View Controller having its own Navigation Controller property?
Image 1:
Image 2:
I tried both but its not working well and its confusing. I'd like to know which is more appropriate so I can focus on that method and then see why it's not working.
The first method you propose is the only method. View controllers have a navigationController property, but it will only return something if your view controller is currently contained within a parent navigation controller.
So to be clear: you should have a UITabBarController which contains your navigation controllers, one navigation controller for each tab that you want to have a navigation hierarchy in.

Adding tabbar controller to uiview

I have a requirement with below steps,
1. Login page
2. Page2
3. Page 3 - table view
Now I want to display a tab barcontroller with 4 tab items on page 3. All the 4 tab items have individual view controller. Page 3 is not one of the items of tab controller, it just contains the tabcontroller so that the user can access 4 other functionalities that the app provides. I do not want to display it on the login page and page 2 so adding the tabcontroller to MainWindow is not a possibility. Can anybody please help me out with adding a tabbar controller to a uiview having uitableview.
You may find this question useful: Tab bar controller inside a navigation controller, or sharing a navigation root view
Alternatively, after Page2 you could swap out the entire root view controller from your window and replace it with a UITabBarController's view. Since this won't be part of a navigation stack, you'll have to manually swap the views.