Question regarding to iphone navigation bar - iphone

Good day everyone, currently I'm doing a simple project which uses the navigation controller default template.
Now I'm done with my current XIB (navigation template), I have created second XIB and I have added a navigation controller on it.
Let say:
It is a hierarchy table view, first the user choose one of the option available on the first table view, after that, will proceed to second XIB with another table view too.
My problem is, I have added one navigation button (Compose Email Item) on second XIB, but when I test run the program and reach second XIB, I couldn't see the button up there. Anyone know what happen?
Thanks.

As you said that you have added a navigation controller in your second .XIB
But for second .XIB there is no need to add navigation controller, you just add UiViewController.
And in viewWillAppear method of second controller add your navigation button

As you said you have added a navigation controller in second xib and added button on that. I think you have not done the connection in the second xib.

Related

Tab Bar mysteriously disappears?

Attached are two images. The first shows my current main.storyboard, and the second shows my problem when I run the app. I have a tab bar controller that has two tabs. On the first tab there is a button. When pressed, the button goes to another view controller with content. At the top is a Navigation bar with a back button. After viewing content, I press the back button, and am back on the original page with the button, but the tab bar is missing. I have seen a few answered questions, but it appears they made their tab bar in the view controller instead of the storyboard. Another says that I should never return to a previous view unless I use an unwind segue. Is this true? If so, how do I set up an unwind segue. If not, how do I fix this problem otherwise? Thank you.
http://i.stack.imgur.com/IYmX2.png
http://i.stack.imgur.com/7slt5.png
The problem is in the wiring of your ViewControllers. You have probably embedded your UITabBarController inside the UINavigationController and not the other way around.
A correct layout looks like this in Interface Builder :
To reproduce:
In Interface Builder drop a UITabBarController. This will come with 2 UIViewController's already wired in.
Pick one of the UIViewController's (let's call it VController1) and click on Editor / Embed in / Navigation Controller. This wires the VController1 to live inside a UINavigationController that is inside the UITabBarController
Add a 3rd UIViewController next to VController1 Let's call it VController3
Wire in a segue between VController1 and VController3, for example with a button.
I hope that's clear enough
Try Linking the button in your viewcontroller (other than the views of the tabbed bar controller) with the tabbed bar controller. Create a segue that links the button with the controller of the tabbed bar application

How to change Root View to Navigation Controller?

I created a Single View application with a view controller that allows you to enter homework assignment data. I now am trying to add onto this app by creating a navigation controller. I want the First Screen to be a Table View, that switches to the homework assignment screen when you click the "Add" arrow.
I've created the Navigation controller onto the Table view, and connected the Add button to the Assignment View Controller, but when I start the app, it still opens up to the Homework Assignment screen.
Can anyone provide a simple way to change the startup screen to my TableView?
EDIT: I am using storyboard. I havent added/edited any new code anywhere for the Table view/ Navigation controller/AppDelegate, I just dragged and connected with storyBoard, I just need to app to startup on the table View instead of the Homework assignment View Controller.
In your storyboard, select the view controller that should be the initial one. Go to the utilities view (on the right). Open the attributes inspector. Tick the Is Initial View Controller checkbox.

Make header view unchanged when switch to another tab

I have a UITabBarController. Now I want to add a view above it, and make the view unchanged when users switch to another tab. I've tried to create a UIViewController, and add the UITabBarController as a subview, but it crashed when I switched to another tab.
Is there any good way to do it? Thanks for any help.
Sure there is. What you'll want to do is make a view controller, which will house the view that is constantly visible, and add the tab bar controller on top of it. If you're using storyboards, this can be accomplished easily using a container view. Simply drag and drop a container from the object library onto the view controller you created, size it as you wish, and link its viewDidLoad segue to embed on the tab bar controller.
http://dl.dropbox.com/u/91385349/tabInView.zip

Add a navigation control to a single tab in xcode 4

I am fairly new to programming with objective-c and xcode 4 and I am trying to make a tab bar application and add a navigation control to a specific tab.
I am able to add a navigation controller inside the tab bar controller, by clicking dragging the navigation controller into the tab bar controller of the MainWindow.xib window. However, by doing this and linking the class and nib to the corresponding view controller and view, respectively, this adds a new tab, which I don't want (as I want a specific/already in existence tab to also contain the nav controller).
Thanks.
I'm not sure what you exactly want to do, but as my understanding, you want navigation controller under tabbar item that is already existed in the tabbar controller. It's not good practice to do it in that way. Rather than that, try add navigation controller first and then add ViewController inside of it (which makes your life easier). Usually Navigation Controller is root of ViewController, but not vice verse. Hope this help.

Toolbar items in sub-nib

This question has probably been asked before, but my google-fu must be inferior to everybody else's, cause I can't figure this out.
I'm playing around with the iPhone SDK, and I'm building a concept app I've been thinking about. If we have a look at the skeleton generated with a navigation based app, the MainWindow.xib contains a navigation controller, and within that a root-view controller (and a navigation bar and toolbar if you play around with it a little). The root-view controller has the RootViewController-nib associated with it, which loads the table-view.
So far so good. To add content to the tool bar and to the navigation bar, I'm supposed to add those to in the hierarchy below the Root View Controller (which works, no problem). However, what I can't figure out is, this is all still within the MainWindow.xib (or, at runtime, nib). How would I define a xib in order for it to pick up tool bar items from that?
I want to do (the equivalent of, just reusing the name here)
RootViewController *controller = [[RootViewController alloc] initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
[controller release];
and have the navigation controller pick-up on the tool bar items defined in that nib. The logical place to put it would be in the hierarchy under File's Owner (which is of type RootViewController), but it doesn't appear to be possible.
Currently, I'm assigning these (navigationItem and toolbarItems) manually in the viewDidLoad method, or define them in the MainWindow.xib directly to be loaded when the app initializes.
Any ideas?
Edit
I guess I'll try to explain with a picture. This is the Interface Builder of the main window, pretty much as it comes out of the wizard to create a navigation based project. I've added a toolbar item for clarity though. You can see the navigation controller, with a toolbar and a navigation bar, and the root view controller.
IB Screenshot http://img526.imageshack.us/img526/3507/rootviewcontroller.png
Basically, the Root View Controller has a bar button item and a navigation item as you can see. The thing is, it's also got a nib associated with it, which, when loaded will instantiate a view, and assign it to the view outlet of the controller (which in that nib is File's Owner, of type RootViewController, as should be).
How can I get the toolbar item, and the navigation item, into the other nib, the RootViewController.nib so I can remove them here. The RootViewController.nib adds everything else to the Root View Controller, why not these items?
The background for this is that I want to simply instantiate RootViewController, initialize it with its own nib (i.e. initWithNibName:nil shown above), and push it onto the navigation controller, without having to add the navigation/toolbar items in coding (as I do it now).
First off, the way you've worded your question is a bit confusing here, but I think I understand.
You've got a couple options here. If you want to design your toolbar, just add one to the view you are loading and drag the various buttons and separators onto it in Interface Builder. Then create IBActions in that view's view controller and drag connections from your toolbar items to the various actions. Since you are using a Navigation controller, though, you will want to hide the toolbar you get by default by unchecking the "Shows Toolbar" box in your MainWindow.xib when the UINavigationController is selected (Attributes tab in the IB inspector).
alt text http://cimgf.com/files/toolbarthing.png
Alternatively, you can just add toolbar items programmatically in the viewDidLoad method by calling [self setToolbarItems:items]; where items is an NSArray of toolbar items.
Really there is no way that I'm aware of to cause the navigation controller to use your custom toolbar. Just hide the main one and use your custom one.