Search code examples
iosclassuiviewuiviewcontrollercomposition

What is the difference between UIView and UIViewController?


I need a detailed explanation on the following:

What do we use a UIViewController for? What is the use of it?

I have a class that looks like the following:

class one
{
    UINavigationController *nav = ...;

    two *secondObject = ...;

    // By use of it, I have push the new view class two//ok
}
class two
{
 ...
}

How can I use secondObject in the class one?

What is the class hierarchical start from the window?


Solution

  • The UIViewController is the controller part in the MVC design pattern.

    Model<------->Controller<------->View

    The controller's task is to handle navigation between different views, key presses, and screen touches etc.