Chapter 4 knowledge points of iOS

Source: Internet
Author: User

Target

Review basic concepts of IOS development

Measure the test taker's knowledge about the commonly used components in the IOS UIKit framework-UIWindow and UIView.

Common screen elements and views

Create a project from 0

Understanding how to use UIImageView and UIImage

1. Review the basic concepts of IOS development

IOS: iPhone OS

Cocoa: A framework developed in Mac OS

CocoaTouch: A Framework developed from the Cocoa framework based on the hardware features of the iPhone.

CocoaTouch is divided into four layers:

Layered frameworks

Cocoa Touch
Multi-Touch, Alerts, Core Motion, Web View, View Hierarchy, Map Kit, Localization, Image Picker, Controls, Camera,
 
Media
Core Audio, pai_png_tiff, OnenAL, PDF, Audio Minxing, Quartz (2D), Audio Recording, Core Animation, Video Playback, OpenGL ES,
 
Core Services
Collections, Core Location, Address Book, Net Services, Networking, Threading, File Access, Preferences, SQLite, URL Utilities
 
Core OS
OSX Kernel, Power Management, Mach, keychainAccess, BSD, Certificates, Sockets, File System, Security, Bonjour
 

MVC: a commonly used design framework for software development projects. All IOS applications follow MVC and define a part of the file processing user interface, called the View layer. Some files process user data, it is called the Model layer. Some files process the interaction between the View and the Model layer, which is called the Control layer.

[Now we will first learn the knowledge of the View Control layer and then the knowledge of the Model layer]

Key points for using MVC in IOS:

(1) View and Model interaction prohibited;

(2) A View can interact with a Control. You can send a request from the View to the Control, called Action. Generally, a Button with the event function is used to send a request.

(3) Control can transmit the processing result to View display, which is called Outlet. Generally, the output port is made of components with the display function.

(4) For all View layers and components, link them to the IBAction and IBOutlet code of the Control layer;

(5) Generally, use the File's Owner in the *. xib File in the View layer to check whether the link in step 1 is correct;

(6) After the link is complete, you can control the response content on the interface through the code in the ViewControl class.

 

2. Understand common components in IOS UIKit framework

For more information, see chapter 4 of the IOS textbook.

 

Basic components:

UIScreen (screen), UIWindow (window), and UIView (View) are several basic interface elements of IOS. UIWindow and UIView are visual components used to construct the user interface for iPhone applications. UIWindow provides a background platform for content display. UIView is responsible for describing most of the content and responding to user interaction.

 

UIScreen: The holes left on the wall of the newly built house;

UIWindow: in this hole, an aluminum alloy frame is installed without glass.

UIView: glass, screen window (UIXXXView), sticker, and window view are installed on the frame)

 

UIWindow

An application has only one window, which is an instance of UIWindow.

The initial border is the size of the entire screen.

Supports window stacked placement

UIView

One window and multiple views

View is responsible for a display area of the screen

View nesting

A view can have multiple subviews

Respond to user touch events

Container

Provides additional visual separation for View content

Widget

It is used to process interaction with users and connect to the Controller class through the IBAction when the xib file is connected.

 

UIButton

UISwitch

Display View

It is used for simple information display. It is connected through IBOutlet when the xib file is connected to the Controller class.

 

UILabel

UIImageView

Warning view and Action Form

Get user attention

UIAlertView

UIActionSheet


 

 

 

3. Common screen elements and common views

Common screen elements:

Status Bar

Top of screen, 20 pixels high

Display Device time, connection, battery status, carrier


Navigation Bar

44 pixels high


Label bar

48 pixels high

At least 44*44 click Areas


Toolbar

44 pixels high


Keyboard

Horizontal display: 320*216 pixels

Portrait display: 480*162 pixels

Adjust the try size on the keyboard and use the scroll view.


 

Common View components:

Table view UITableView

Image view UIImageView

Rolling view UIScrollView

Text View UITextView

 

 

4. Create a project from 0

(1) Create an empty IOS APP

(2) There is only delegate, and a Window is automatically created based on the screen, called the Root View.

(3) We want to create the Root View and create a user interface.> Window is called MainWindow. xib.

(4) Open MainWindow. xib in Interface Builder and set this file as the UIApplication required when a program starts. Click File's owner à 3rd property panels (identity checker) to set the currently selected object and the class in the corresponding program.

Enter UIApplication

(5) In IB, add a delegate object icon, click the icon-> 3rd property panels, and set the class name corresponding to the icon to XYZAppDelegate.

[In this step, the two objects required to start in main () are created, and then connected]

 

(6) open the File's Owner of the MainWindow. xib File-> 6th panels (connection checker)

Connect the delegate output port to the delegate object icon

(7) The fourth parameter is the name of the UIApplicationDelegate class of the application proxy class. If it is nil, the system will go from Main nib [Main nib file in info. in the plist file, specify the value corresponding to the Main nib file base name field.] The file searches for the Application Object and connects to its delegate.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.