1.Instance variables that are pointers to other objects are called outlets. Methods that can be triggered by user interface objects are called actions.
2. this book,we discuss the following major types of projects:
Application: A program that creates windows.
Tool: A program that does not have a graphical user interface. Typically,a tool is a command line utility or a daemon that runs in the background.
Bundle or framework: A directory of resources that can be used in an application or a tool. A bundle (also called a plug-in) is dynamically loaded at runtime. An application typically links against a framework at compile time.
3.#import is similar to the C preprocessor's #include. However, #import ensures that the file is included only once. You are importing<Cocoa/Cocoa.h> because that includes the declaration of NSObject,which is the superclass of Foo.
Note that the declaration of the class starts with @interface. The @ symbol is not used in the C programming language. To minimize conflicts between C code and Objective-C code,Objective-C keywords are prefixed by @. Here are a few other Objective-C keywords: @end,@implementation,monospace">@class,monospace">@selector,monospace">@protocol,monospace">@property,monospace">and @synthesize.
4.Let's brIEfly discuss the chronology(年表) of an application: When the process is started,it runs the NSApplicationMain function,which creates an instance of NSApplication. The application object reads the main nib file and unarchives the objects insIDe. The objects are all sent the message awakeFromNib. Then the application object checks for events. The timeline for these events appears in Figure 2.26.
When it receives an event from the keyboard and mouse,the window server puts the event data into the event queue for the appropriate application,as shown in Figure 2.27. The application object reads the event data from its queue and forwards it to a user interface object (like a button),and your code gets triggered. If your code changes the data in a vIEw,the vIEw is redisplayed. Then the application object checks its event queue for another event. This process of checking for events and reacting to them constitutes the main event loop.
When the user chooses Quit from the menu,monospace">NSApp is sent the terminate: message. This ends the process,and all your objects are destroyed.
总结以上是内存溢出为你收集整理的Cocoa Programming for Mac OS X 第二章(Let's Get Started)摘录全部内容,希望文章能够帮你解决Cocoa Programming for Mac OS X 第二章(Let's Get Started)摘录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)