TalkingCode
TalkingCode

Reputation: 13557

iOS: Definition of the term "RootViewController"?

I am working on a little iOS tutorial for my friends but I got a little problem explaining the meaning of the term "RootViewController"

For someone coming from the WinForms or WPF world its not always easy to understand why a window needs a additional ViewController.

Why dont't you place controlls directly on the window and what makes the RootViewController so special?

Upvotes: 0

Views: 630

Answers (2)

Tomasz Wojtkowiak
Tomasz Wojtkowiak

Reputation: 4920

There are two good guides to understand this topic: View Programming Guide and View Controller Programming Guide.
The simplest answer is, that UIWindow (window) is only container for application, which don't have any visible content themselves.

Upvotes: 0

Wubao Li
Wubao Li

Reputation: 1748

  1. in iOS, each application generally have only one window, some times there is one external window. this window is the root view of your application.

  2. just like WinForms, each WinForm is a view controller in iOS Application.

  3. In general, iOS application have more than one set of views to display. just like there are several winForm in the windows form application. to navigate between the view sets, organize them to different view (viewController).

  4. about "RootViewController". the difference with other normal view controllers, is , if a view controller is assigned as root view controller, iOS will change the view controller's view frame, For example, in your code, assigned it to the window, iOS will change the view controller's view frame to [UIScreen mainScreen].applicationFrame .

Upvotes: 1

Related Questions