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

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.

Related

push segue not showing my detail page

I have a tableview with about 10 items.
I have set up a UIView Controller as a detail page.
I Control-Drag from my cell in the tableview to the new view controller, and I can create a Push Segue, however the navigation control does not appear on the new view controller.
When I run the application my prepareForSegue method executes but my application does nothing. The detail UIView Controller does not display.
What step am I missing to make this work?
The Push segue only makes sense for ViewControllers embedded inside a UINavigationController. You can do this easily by selecting your tableview's ViewController in the storyboard and choosing in the main menu:
Editor -> Embed In -> Navigation Controller

Navigation Controller with static table cells?

I'm trying to add a view that is a form that has 3 elements. These elements will be inside of a static grouped table. I need a navigation bar at the top with a "Save" and "Cancel" button. Both buttons should send the user back to their previous screen when tapped.
Within the storyboard, I have tried creating a Navigation Controller and then adding a table to it, but I get the error of "Static table view are only valid when embedded in UITableViewController".
So, I tried creating a Table View Controller, but the storyboard won't let me put a navigation bar into one of those for some reason...
What is the best way to go about doing this?
Add UITableViewController to your storyboard and then choose Editor > Embed in > Navigation Bar Controller from the menu. This will wrap your table view controller in a nav bar controller and you can then add your Save and Cancel buttons to the navigation bar.
It might seem a bit wasteful to create a navigation controller with only a single sub-controller just to get a navigation bar but it's the accepted way of doing it.
Oh... this iOS stuff is hurting my head.
I wanted to do the same thing, have a TableView, with a Navigation Bar at the top, but there was no "Embed in.. Navigation Bar" menu item, just "Embed in.. Navigation Controller".
Eventually, solving this was easier than I thought.
I just needed to add a Table View Controller to my storyboard, then CTRL+drag a Segue from the "calling" view controller to my new Table View Controller, and, voila, it gives me the Navigation Bar straightaway.

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.

Customizing UIModalViewController Size and Having a Navigation Bar

I've created my own ProfileUIViewController class that is a UINavigationControllerDelegate. I display this view in two ways:
From an IBAction within A-UIViewController.m, as a UIModalViewController. A-UIViewController has a UINavigationBar when it's loaded, but when I display the modal, it no longer has the navigation bar.
From clicking a table cell row within B-UIViewController.m, by pushing it onto the stack. B-UIViewController has a UINavigationBar when it's loaded, and the ProfileViewController keeps the navBar as desired :)
What I am looking to do is keep the UINavigationBar when the view is loaded as a modal in case 1, filling in INSIDE the UINavigationBar instead of laying over the entire view. (IE, I would like the modal to appear within A-UIViewConroller underneath the navBar - making it a smaller size)
Can someone help me with this? Do I need to make my own custom ModalViewController class - wouldn't this be ProfileUIViewController? Does it need some instance methods that I'm not giving it? Any direction would be great:)
The navigation bar is managed by the navigation controller, not by your view controller. When you push your view controller into the navigation controller, the navigation controller uses the information in the navigationItem to determine what to put in the navigation bar. But when you display your view controller modally, it's not inside any navigation controller so there is no bar.
One simple solution for the modal case is to create a new UINavigationController with your view controller as its root view controller, and display that modally instead of displaying your view controller directly.

How to know - view controller's current view in iphone

Let's have an example.
In application I have a tab bar controller.
Tab bar has two items dynamically - two view controllers.
User can select any of tab.
Suppose user selects first tab.
First view controller is already loaded.
Now he clicks on a button of First view controller.
From First View controller -> Second View controller is pushed.
Now when user taps on tab bar first item
second view is popped out.
This is done through by default by tab bar controller.
Now, If I want to check following condition
if(tab bar first item-view controller has first view controller view)
then perform this
if(tab bar first item-view controller has second view controller view)
then perform this
How to implement this logic?
If you are using a UITabBarController, you can use its selectedViewController property to know what kind of view controller is on the screen, so if you have two subclasses of view controller FirstViewController and SecondViewController you can say
if([[tabBarController.selectedVIewController isKindOfClass:[FirstViewController class]])
//... do something
else ...