简体   繁体   中英

naming conventions - uinavigationcontroller and root view

This may be the silliest question i have ever asked here, but i just can't seem to understand this. I am new to xcode and iOS development, and these days trying to learn how uinavigtioncontroller works. In all the examples and tutorials that i see (none of which could help me btw...maybe b/c of the new xcode?), there is always a mention of a RootViewController class. Now, when I open a new view based app project, i immediately get the app delegate class and another object called: MyProjectViewController. So my question is - is this RootViewController that everyone are talking about IS the MyProjectViewController that is created for me automatically? OR do they open a new class and call it RootViewController? OR do they just change its name from MyProjectViewController to RootViewController? (or something else...:))

Thanks for the help!

There is nothing special with RootViewController. It is just another view controller. You can have your own eg MyTopViewController as your root view controller.

When you use a navigation controller, you navigate through many view controller. The fist one in the stack, where you start to navigate is called root view controller. But RootViewController is just a class name.

Usually, when you create a project, if you open the MainWindow.xib, you can find all the reference to the default created file. Even you can change the name of MainWindow.xib.

If you open the {Project-Name}-Info.plist file, in your project, you can find an option for main xib file, which refers to the MainWindow.xib file. Here you can customize which is the one xib file you want to load at first runtime.

In xcode 4 - when you create a navigation controller project you get a RootViewController class.h/.m/.xib created for you.

You can add these to the basic project type, but that is what the tutorials are referring to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM