Objective-C课件.ppt

  1. 1、本文档共24页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Apple and Mac OS X NeXT is taken over by Apple in 1996 and put Steve Jobs and his Objective-C libraries to work Redesigned Mac OS to use objective-C similar to that of NeXTSTEP Developed a collection of libraries named “Cocoa” to aid GUI development Release Mac OS X (ten), which was radically different than OS 9, in March 2001 精品文档 The Cocoa API Primarily the most frequently used frameworks nowadays. Developed by Apple from NeXTSTEP and OPENSTEP Has a set of predefined classes and types such as NSnumber, NSstring, Nsdate, etc. NS stands for NeXT-sun Includes a root class NSObject where words like alloc, retain, and release come from 精品文档 Dynamic Language Almost everything is done at runtime Uses dynamic typing, linking, and binding This allows for greater flexibility Minimizes RAM and CPU usage 精品文档 To Import or Include? C/C++’s #include will insert head.h into the code even if its been added before. Obj-C’s #import checks if head.h has been imported beforehand. #import head.h 精品文档 Messages Almost every object manipulation is done by sending objects a message Two words within a set of brackets, the object identifier and the message to send. Because of dynamic binding, the message and receiver are joined at runtime [Identifier message ] 精品文档 Basic syntax structure C++ syntax Objective-C syntax void function(int x, int y, char z); Object.function(x, y, z); -(void) function:(int)x, (int)y, (char)z; [Object function:x, y, z]; 精品文档 Keyword: id The word ‘id’ indicates an identifier for an object much like a pointer in c++ This uses dynamic typing For example, if Pen is a class… extern id Pen; id myPen; myPen = [Pen new ]; (Cox, 59) 精品文档 Memory Allocation Objects are created dynamically through the keyword, “alloc” Objects are dynamically deallocated using the words “release” and “autorelease” autorelease dealocates the object once it goes out of scope. NOTE: None of these words are built-in 精品文档 Ownership Objects are initially owned by the id that created them. Like C++

文档评论(0)

liuxiaoyu98 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档