Cocoa Programming for Mac OS X 第一章(What Is It?)摘录

Cocoa Programming for Mac OS X 第一章(What Is It?)摘录,第1张

概述A Little History Apple has made the source code to the Unix part of Mac OS X available under the name Darwin. A community of developers continues to work to improve Darwin. You can learn more about Da

A little History

Apple has made the source code to the Unix part of Mac OS X available under the name Darwin. A community of developers continues to work to improve Darwin. You can learn more about Darwin at http://macosforge.org/.


NeXT then wrote a window server for the operating system. A window server takes events from the user and forwards them to the applications. The application then sends drawing commands back to the window server to update what the user sees. One of the nifty things about the NeXT window server is that the drawing code that goes to the window server is the same drawing code that would be sent to the printer. Thus,a programmer has to write the drawing code only once,and it can then be used for display on the screen or printing. In the NeXTSTEP days,programmers were writing code that generated postscript. With Mac OS X,programmers are writing code that uses the CoreGraphics framework (also kNown as Quartz). Quartz can composite those graphics onto the screen,send them to the printer,or generate pdf data. The Portable document Format is an open standard created by the Adobe Corporation for vector graphics.


@L_404_2@If you have used Unix machines before,you are probably familiar with the X window server. The window server for Mac OS X is completely different but fulfills the same function as the X window server: It gets events from the user,forwards them to the applications,and puts data from the applications onto the screen. At the moment,the X protocol has poor support for antialiased Fonts and transparency. This is one of the reasons that the Mac OS X window server looks so much better than an X window server.

NeXTSTEP became Mac OS X. It is Unix underneath(下面的;底部的),and you can get all the standard Unix programs,such as the Apache Web server,on Mac OS X,which is more stable than windows and Mac OS 9. The user interface is spectacular. You,the developer,are going to love Mac OS X because Cocoa will enable you to write full-featured applications in a radically more efficIEnt and elegant manner.


Frameworks

framework is a collection of classes that are intended to be used together. In other words,the classes are compiled together into a reusable library of code. Any related resources are put into a directory with the library. The directory is renamed with the extension .framework. You can find the built-in frameworks for your machine in /System/library/Frameworks.

Cocoa is made up of three frameworks:

Foundation: Every object-orIEnted programming language needs the standard value,collection,and utility classes. Strings,dates,Lists,threads,and timers are in the Foundation framework.

AppKit: All things related to the user interface are in the AppKit framework. windows,buttons,text fIElds,events,and drawing classes are in the AppKit. You will also see this framework called the ApplicationKit.

Core Data: Core Data makes it easy to save your objects to a file and then reload them into memory. We say that Core Data is a persistence framework.

Numerous other frameworks handle such dutIEs as encryption,QuickTime,and CD burning,but this book focuses on Foundation,AppKit,and Core Data because they are the most commonly used. Once you have mastered these,the other frameworks will be easIEr to understand.


Most of the time,Cocoa fulfills the promise: Common things are easy,and uncommon things are possible. If you find yourself writing many lines of code to do something rather ordinary,you are probably on the wrong track.


Common Mistakes

Having watched many,many people work through this material,I've seen the same mistakes made hundreds of times. I see two mistakes particularly often: cAPItalization mistakes and forgotten connections.

It is easy to miss some warnings the first time a file is compiled. Because Xcode does incremental compiles,you may not see those warnings again unless you clean and rebuild the project. If you are stuck,try cleaning and rebuilding.

总结

以上是内存溢出为你收集整理的Cocoa Programming for Mac OS X 第一章(What Is It?)摘录全部内容,希望文章能够帮你解决Cocoa Programming for Mac OS X 第一章(What Is It?)摘录所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1066407.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存