iphone - transforming a view-based project
sorry bothering you guys with this silly question, but I am a kind of noob in iphone development. What I need to do is this. I have a project developed by a friend of mine, that is view-based. He created it based on the original apple template on Xcode.
After banging my head on the wall, I realized that I need to transform this project from view based to UINavigation based project. What I mean is: his project has one view controller and one delegate. When it runs, the delegate calls the view controler and the equivalent view loads.
What I need is to insert a UINavigationController before the ViewController, because I am planning to have a second ViewController managed by this UINavigationController, so I can do slide transitions between them and things like that.
My question is: I imagine this is not a complex operation if you want where to change. Which changes and where should I do them, in order to add a UINavigationController before the viewController? I imagine this will change the hierarchy to:
Delegate > UINavigagionController > ViewController
Remember that this project was based on the Xcode View-based tem开发者_开发问答plate, so I will probably have to change stuff on Interface Builder.
Thanks.
- In IB, add a
UINavigationController
to your MainWindow.xib. - Drag the existing view controller onto the nav controller icon to make it the nav controller's root controller.
- In your code, add a property to your application delegate for the navigation controller. Mark it as
IBOutlet
. - In IB, connect the navigation controller object to the navigation controller outlet in your app delegate.
- In your code, in
-application:didFinishLaunchingWithOptions:
, change the references to your original view controller to the new navigation controller property.
精彩评论