IOS TOPICS

IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Views
Table View
Collection Views
SCROLL VIEW
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

UIViewController


UIViewController

ViewControllers are the fundamental components of iOS apps. To construct an iOS application, a ViewController is a container in the storyboard on which the content views are created. The ViewControllers, on the other hand, are the ones in charge of an iOS application's content views.

To handle content views in iOS programming, we utilize a variety of ViewControllers, such as UIViewController, TableViewController, CollectionViewController, PageViewController, and so on. We'll talk about UIViewController in this portion of the course.

A UIViewController is an object that handles the UIKit application's view hierarchy. The UIViewController defines the behavior and attributes shared by all types of ViewController in an iOS application. The UIViewController class inherits the UIResponder class.

class UIViewController : UIResponder

UIViewController is the base class for all view controllers used in iOS development, including in-built view controllers such as CollectionViewController and TableViewController. We don't need to explicitly instantiate the UIViewController class in iOS apps. Instead, we create a class that inherits from UIViewController and adds the view hierarchy management lifecycle methods.

The UIViewController has the following duties.

  • It keeps the content of the views up to date.
  • It makes the views interactive so that they may react to user-initiated events.
  • It resizes the views and controls the overall interface layout.

We utilize many view controllers in conjunction to create a real-time iOS app, with each view controller representing a distinct part of the program. UIViewController is in charge of the application's cooperation with the other view controllers. A ViewController can display a fresh set of views by presenting different view controllers, and it may also serve as a container for the content of other view controllers.

At least one UIViewController subclass may be found in every iOS application. To make an iOS app, we construct several custom view controllers that define the program's general functionality. In the next part, we'll go through our custom UIViewController subclass's features.