The first day of OC-Xcode, project composition and running status, oc-xcode

Source: Internet
Author: User

The first day of OC-Xcode, project composition and running status, oc-xcode

IOS Engineering Template in Xcode:

1. Application Type:

  • Master-detail Application. You can build a tree-like navigation mode Application. The generated code contains the navigation controller and graphic controller. (Graph controller refers to the interface in the navigation Controller );
  • Game. Build iOS-based Game applications;
  • Page-Based Application. tiled navigation, similar to the e-book effect;
  • Tabbed Applecation. Build the tag navigation mode application. The generated code contains the tag controller and Tab bar.
  • Single View Application. Build a simple Single View Application.

2. Framework & Library type

  • Cocoa Touch Framework: Custom Application to the UIKit Framework;
  • Cocoa Touch Library: allows you to create static libraries based on the Foundation framework;

3. Other type

  • You can build an in-APP purchase content package empty project-an application with built-in charging function.

 

 

Main Components in the new project: AppDelegate and ViewController

  • AppDelegate: inherits the UIResponder class and implements the UIApplicationDelegate delegation protocol. It is the delegate object of an application. A series of inherited methods in this class will be called back at different stages of the application lifecycle.

Application cycle:

A. the life cycle of a program refers to the whole process from application startup to application end.

B. Each IOS application contains a UIApplication object. The IOS system uses this UIApplication object to monitor the entire application lifecycle process.

C. Each IOS application must specify a proxy object for its UIApplication object and process the application lifecycle events monitored by the UIApplication object.

  • ViewController: View Controller class. It is the root view and user event control class in the project.

 

 

Five statuses of iOS apps:

  • Not Running (Not Running ). The application is not running or terminated by the system.
  • Inactive ). The application is in the foreground status, but cannot receive event processing.
  • Active (foreground activity status ). The application enters the foreground status and can receive event processing.
  • Background (Background status ). The application enters the background status and can still execute code. If there is executable code, the code will be suspended if it is not executed.
  • Suspended ). In this status, the application does not execute code. If the memory is insufficient, the application will be terminated.

Simulated call of iOS running status:

  • Not Running --> Inactive: Call application: didfinishlaunchingwitexceptions: The method sends the UIApplicationDidFinishLaunchingNotification.
  • Inactive --> Active: Call applicationDidBecomeActive: The method sends the UIApplicationDidBecomeActiveNotification notification.

2. The Application is running. clicking the Home key or another Application causes the current Application to be interrupted: (the Application does not run in background status is controlled based on the related property in the product property file)

1> it can be run or Suspended in the Background: Active --> Inactive --> Background --> suincluded

  • Active --> Inactive: Call applicationWillResignActive: Method to send the UIApplicationWillResignActiveNotification notification.
  • Inactive --> Background: The application enters the Background when it is Inactive.
  • Background --> Suspended: Call applicationDidEnterBackground: Method to send a UIApplicationDidEnterBackgroundNotification notification.

2> it cannot be run or Suspended in the Background: Active --> Inactive --> Background --> suincluded --> Not running

  • Active --> Inactive: see
  • Inactive --> Background: The application enters the Background when it is Inactive.
  • Background --> Suspended: Call applicationDidEnterBackground: Method to send a UIApplicationDidEnterBackgroundNotification notification.
  • Suspended --> Not running: Call applicationWillTerminate: The method sends the UIApplicationWillTerminateNotification notification.

3. Memory cleanup-application termination scenario

  • The application enters the suspended state (a sleep state) after processing in the background. If this is the case that the memory is insufficient, in order to meet the memory requirements of other applications, the application is cleared from memory and thus stops running.
  • Background --> suincluded --> Not running

 

View lifecycle:

Create a view ------> viewDidLoad:

-------> ViewWillAppear:

View visibility

-------> ViewDidAppear:

-------> ViewWillDisappear:

Invisible View

-------> ViewDidDisappear:

 

 

-------> DidReceiveMemoryWarning:

Low system memory

-------> ViewDidUnload:

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.