Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • iOS UIKit Framework and its Components

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 7.90k
    Comment on it

    The UIKit framework is used to provide graphical infrastructure and event-driven interface for the iOS application. The User interface can be implemented by window and view architecture which is provided by the UIKit framework. It manages the interaction between the user, system, and application. It provides features like multi-touch, input to the application, animation support, drawing support, document support, printing support, management and display of text, resource management, current device information, accessibility support, extension support and searches support.

     

     

    Below are some points provided by the UIKit framework:-

     

    •      App Structure
    •      User Interface
    •      Event Handling
    •      Graphic, Drawing, and Printing
    •      Text
       

    App Structure

    The UIKit framework manages the interaction between the system and user. It also provides classes to manage the application resources and data.

     

    User Interface

    It helps in user interactions, share text/content, select images, edit videos, print files with the help of inbuilt UIKit view controllers

     

    Event Handling

    It handles different gestures with the help of gesture recognizer. Gestures can be categorized into keyboard input gesture, button tap gesture, multi-touch gesture etc.

     

    Graphic, Drawing, and Printing

    It provides drawing environment to draw paths, shadows, and strings. Images can be created and managed by the UIKit. Printing of text files process is managed by the UIKit.

     

    Text

    It provides text spelling check functionality, font management, text display, text storage, custom keyboards can be created and system keyboard can be configured.

     

     


     

     

    Components of UIKit

     

    The UIKit framework provides many components that can be used to make the user interface more interactive. Some of them are listed below which are most commonly used and effective:-

     

    • UIView
    • UILabel
    • UITextFeild
    • UIButton
    • UIAlert
    • UIViewController
    • UINavigationController

     

    UIView

    It can be defined as a rectangular area and responsible for managing the content of that particular area. Multiple UIView can be used in a single screen for a different task.

    The background color of UIView can be set in two ways:-

    • Directly from storyboard only by selecting particular view -> go to view background option -> select color
    • With the help of code also same can be done
      @IBOutlet weak var backgroundView: UIView!
      override func viewDidLoad() {
            super.viewDidLoad()
            backgroundView.backgroundColor = UIColor.red
        }

     

    UILabel

    It is also a view used to show data in the user interface. Multiple lines of data i.e text can be shown to the user with the help of UILabel. Most probably UILabel is used to directly write data in the storyboard, show data through coding and text color can also be changed according to the need.
     

      @IBOutlet weak var txtUsername: UITextField!
        override func viewDidLoad() {
            super.viewDidLoad()
            txtUsername.textColor = UIColor.blue
        }

     

    UITextField

    It is an editable view which takes input from the user and that input can further save or use according to the need of the situation. Placeholder value is used to tell the user which value is required in that particular field. UITextField value can be used as given in below lines of code:-
     

    
        @IBOutlet weak var txtUsername: UITextField!
        override func viewDidLoad() {
            super.viewDidLoad()
            let userName = txtUsername.text
            print("UserName is \(userName)")
        }

     

    UIButton

    It is used to perform action on button click according to the user interaction.

    In the below code on button click action an alert will be shown which contains a message:-

     

        @IBAction func btnLoginClick(_ sender: AnyObject) {
            let alert = UIAlertView(title: "UIKit Demo", message: "You successfully logged in", delegate: self, cancelButtonTitle: "Ok")
            alert.show()
        }

     

    UIAlert

    It is used to show an alert message to the user and blocks the screen until the user performs an action on the button available on alert.

     

    UIViewController

    It is used to manage all the views available in the UIKit framework to make the user interface of an application interactive.

    Important responsibilities of a view controller’s are:

    • It keeps content of the view updated, generally to acknowledge the changes to the underlying data.
    • It responds the user interactions with views.
    • It resizes views and manages the layout of the overall interface.

     

    UINavigationController

    It is used to maintain the hierarchy between the controllers. It makes data more efficient to show and navigate from one controller to another very easy. It uses the navigation stack to manage the controllers.

     

    iOS UIKit Framework and its Components

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: