I have been in at the deep end for a week now learning from every source i can, resisting posting as i know how irritating it is for n00bs asking stupid questions on your expert subject.
However… after hours spent on this chapter 9 or Beginning iPhone Development book regarding a navigation app, i have surrendered and posted here.
what i have done so far is posted here (https://files.me.com/taylorsuk/jr6xj1)
i have got to two screens and then it will not go any further?
following the instructions implicitly i am unable to connect the NavController to the RootViewController? in the class option – the option isn’t there.
trying to learn so would be great if you could guide me through this simple thing – all code should be there!
This is needed for a little project that i am doing for someone (which i will admit i am out of my depth, however if there is anyone who is willing to help me on a one to one basis i could send you some money as i am going to get paid for the job.)
Cheers all
Simon
As Adam points out, you can create a navigation controller programmatically but you can also do it in Interface Builder to cut down on code. I prefer this, it’s analogous to instantiating the controller and setting some of its basic properties.
In Xcode, double click on your MainWindow.xib file. This will open it in Interface Builder.
In the library, find “Navigation Controller” among the objects list. It should be a black arrow tab pointing left on an orange background. Drag it into the tray or into the window representing MainWindow.
Click on the view of the navigation controller (the view should be highlighted). In the inspector, give a valid xib file name in the NIB name (you can leave off .xib”). This sets the root view. You might need to create a new UIViewController class in XCode with its xib just for the purpose of this exercise.
Again in the inspector, find “class name” and enter the name of the UIViewController class associated with your xib file from 3.
Back in XCode, in the header of your app delegate file, declare something like
IBOutlet UINavigationController nc. You can make an associated property and synthesise it if you like.Head back to Interface Builder, and in the tray right-click (i.e. CTRL+click) the navigation controller. Drag from “new referencing outlet” over to “File’s owner”. You should be able to choose
ncfrom the list of outlets.And that’s that. Compile and run.
I’ve probably missed something. Anyone reading this, please feel free to correctly correct my answer. There are plenty of tutorials on YouTube that explain this far better than I did.