Initial knowledge of iOS

Source: Internet
Author: User

What's different about writing iOS apps
  • 1. You can only run one application at a time: When the program is not active and not running in the background, it does not consume any CPU resources and therefore also disconnects the network. iOS allows programs to be processed in the background, but to do this, developers need to do more
  • 2. There is only one window: iOS allows the application to operate only one window, and all of the application's swap with the user is done in this window, and the size of the window is fixed by the size of the iOS device screen.
  • 3. Limited access: iOS restricts access to applications, and iOS's file system assigns each application a separate area, called a sandbox, in which each application can read and write only the files in its own sandbox. Applications are also subject to other limitations, such as the inability to access network ports with smaller port numbers in iOS.
  • 4. Limited response time: Due to the special way of use, iOS needs to be able to quickly respond to a variety of times, the application should be so, at any time when the application is running, you can go back to the main interface by clicking the Home button, the application must quickly save everything and exit If the necessary data is not saved within 5 seconds and the control of the system resources is discarded, the application is terminated regardless of whether it has been saved. There is an API that can request more time to complete the necessary work before the application terminates, and you must know how to use it.
  • 5. Limited screen size: Because of the problem of screen size, can not put more controls, greatly affect the type of application and interactivity can be provided.
  • 6. Limited system resources: Due to the graphics features and various features of iOS, memory is easily consumed, so cocoa touch provides a built-in mechanism to notify applications when there is insufficient memory, and the application must free up unnecessary memory space or it may be forced to exit.
  • 7. Garbage collection is not supported: Cocoa Touch uses objective-c, but iOS does not support a key feature that Objective-c has long existed: garbage collection. This requires the developer to manually manage the memory themselves. However, in the latest version of iOS basically solves this problem, thanks to arc (Automatic Reference counting, automatic reference counting) function, arc is not a garbage collection of substitutes, in fact, in many ways, it is better than garbage collection.
  • 8. A different way of switching: iOS devices do not have a keyboard and mouse, and most of the switching is done by the iOS system. For example, if the text box is applied, the iOS system will bring up the soft keyboard when the user clicks the text box, without requiring the developer to write extra code for it.
Sub-Mirror (storyboard): Each mirror is composed of a group or groups of corresponding views and controllers, the view is the part that your eyes can see and can be edited in the interface Builder, and the controller is the application code you write, to handle the user's interactive events, The actual operation of the application is done in the controller. The interface Builder consists of three items:
    • View Controller: The View Controller representative loads the controller and associated views from a storage file.
    • First Responder: The Responder is simply the object that the user is currently interacting with, and if the user is entering data into a text box, the text box is the first responder. The first responder changes as the user interacts with the user interface, and with the first responder icon, you can easily communicate with objects that are currently the primary responder's control, and you do not need to write code to determine which control is currently the first responder.
    • Leave (exit)
MVC mode (Model-view-controller):
    • Model: A class that holds application data.
    • Views: Include Windows, controls, and other elements that users can see and interact with.
    • Controller: The code that binds the model and view together, including the application logic that handles user input.
The goal of MVC is to maximize the separation of these 3 types of code. Any object created should be very clear and clear, giving the person a look at the classification (model, view, or controller) that this object belongs to, and try not to include features that might be considered to belong to multiple classifications. For example, the object that implements the button should not contain code that handles the data when the button is clicked, and the object that implements the bank account should not contain the code that draws the table to display the transaction data. There are three basic modes of user interface controls: Active, static (also called inactive), and passive.
    • Active controls: Something happens when you click on them, usually triggering an event code that you write yourself.
    • Static controls: Controls similar to the image view, although some configuration of the Uiimageview control enables it to trigger an action method, the user cannot do anything, and the label and image are generally used this way.
    • Passive control: Used only to store user-entered values for later use. These controls do not trigger any action methods, but users can interact with them and modify their values. A typical example of a passive control is a text box.

Initial knowledge of iOS

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.