Cocoa program Startup Process

Source: Internet
Author: User

DetailsCocoa program startupThe process is what we will introduce in this article. First, ourProgramThe runtime is the interaction between objects, rather than between classes.

Create a hellowordCocoa Program, You can find the following objects in xib:

File's Owner: the Owner of the xib file.

Firsrt responder: the first object in the message chain that can respond to the corresponding message.

Application: an instance of nsApplication.

Main menu: an instance of nsmenu.

Window app delegate: Delegated instance of application

Font manager: an instance of nsFontManager.
 
1. Start the program and instantiate an nsapplication starting from mian.

2. How does the application load mainmenu. xib? How does it know to load this sib file instead of anything else? This is actually specified in the info. plist file.

3. After the application loads the File, it becomes the mainmemu. xib File 'owner.

4. nsApplication has a delegate Outlet to specify its delegate object.

5. The application instance will call the method in window app delegate when loading the xib file.

6. After the applcation loads the xib file, it will instantiate other classes in the file based on the file content, create a window, and try to wait. Enter the message loop.

7. firsrt responder is the first object in the message chain that can respond to the corresponding message. It is not a specific object, such as a copy menu on a single machine, if the current focus is in the edit box, the first message that can respond to "copy" may be an edit box. If the current focus is in the browser, the first one that can respond to the message is the browser view object.

Summary: DetailsCocoa program startupThe process has been introduced. I hope this article will help you!

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.