Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a UIViewController

I know what a UIView is but not a UIViewController. I just want to know what I could use it for, and what it is compared to a UIView

like image 689
Jab Avatar asked Feb 03 '10 13:02

Jab


People also ask

What is the difference between ViewController and UIViewController?

Both are used for different purpose. A UIViewController class manages a ViewContoller which is responsible for actions that happen within that View controller. This class is aware of actions that happen on view controller, like ViewDidLoad, ViewWillApper, ViewDidAppear, ViewWillDisapper, ViewDidDisapper.

What is UIViewController life cycle?

The LifecycleThe view controller lifecycle can be divided into two big phases: the view loading and the view lifecycle. The view controller creates its view the first time the view is accessed, loading it with all the data it requires. This process is the view loading.

Is a ViewController a view?

A view controller manages a single root view, which may itself contain any number of subviews. User interactions with that view hierarchy are handled by your view controller, which coordinates with other objects of your app as needed. Every app has at least one view controller whose content fills the main window.

What is a UIResponder?

An abstract interface for responding to and handling events.


1 Answers

Basically you need to know, what is model-view-controller architecture in the software engineering field, the UIView corresponds to view of this architecture and UIViewController is at controller side of this architecture.

Now UIViewController can be thought as an agent that controls (and has the implementations of methods) the events and design of the UIView that is shown on the screen. Anything you want to change on the view can be written inside a method in its controller class, that inherits itself from UIViewController class. That is only the brief description of this big concept. For details you should look for the above link.

like image 184
Madhup Singh Yadav Avatar answered Sep 18 '22 00:09

Madhup Singh Yadav