刚刚接触objective-c,就开始从这份官方文档开始吧。写这份笔记主要是为了让自己能够更认真的阅读文档,也为了能够给其他人一些参考。由于本人英文水平有限难免有些地方理解不对,还希望大家能够帮忙纠正多多的相互交流。
原文地址:http://developer.apple.com…Introduction/introObjectiveC.html
- 一个面向对象的编程语言
- 一个对象库
- 一套开发工具
- 一个运行时环境
这份文档就是讲解关于开发环境的第一个组成部分——开发语言。本文档全面叙述了在Mac OS X v10.6 and iOS4.0中所发布的objective-c版本。这份文档也同事讲解了一些关于学习第二部分的基础,Cocoa —— objective-c应用框架集合。关于运行时环境在一份单独的文档中进行介绍,叫做 Objective-C Runtime Programming Guide.
- 用objective-c编程
- 想要了解关于Cocoa应用框架的基础
此文档同时介绍了作为objective-c语言建立基础的面向对象模式和全面的语言文档。它主要专注于objective-c对于c扩展的部分, 而不在于c语言本身。因为这不是一个c语言的文档,它假设对于c语言是熟悉的。然而,objective-c的面向对象编程同c语言的面向过程编程是完全 不同的。所以即使你不是一个熟练的c程序员也无妨。
以下章节涵盖了所有objective-c相对于标准c所加入的特性文档末尾的词汇表提供了关于objective-c和面向对象语言特殊术语的解释。
@interface
ClassName
(
CategoryName
)
表示
@interface
和一对括号是必须的,但是ClassName和CategoryName就可以自由选择了.如下代码所示,省略号表示有一部分代码被省略:
- (void)encodeWithCoder:(NSCoder *)coder
{
[super encodeWithCoder:coder];
…
}