Introduction to The Objective-C 2.0 Programming Language
来源:互联网 发布:mac os 进入恢复模式 编辑:程序博客网 时间:2024/05/21 19:32
Introduction to The Objective-C 2.0 Programming Language
Contents:
Who Should Read This Document
Organization of This Document
Conventions
See Also
The Objective-C language is a simple computer language designed to enable sophisticated object-oriented programming. Objective-C is defined as a small but powerful set of extensions to the standard ANSI C language. Its additions to C are mostly based on Smalltalk, one of the first object-oriented programming languages. Objective-C is designed to give C full object-oriented programming capabilities, and to do so in a simple and straightforward way.
Most object-oriented development environments consist of several parts:
An object-oriented programming language
A library of objects
A suite of development tools
A runtime environment
This document is about the first component of the development environment—the programming language. It fully describes the Objective-C language, and provides a foundation for learning about the second component, the Mac OS X Objective-C application frameworks—collectively known as Cocoa. You can start to learn more about Cocoa by reading Getting Started with Cocoa. The two main development tools you use are Xcode and Interface Builder, described in Xcode Workspace Guide and Interface Builder respectively. The runtime environment is described in a separate document,Objective-C 2.0 Runtime Programming Guide.
Important: This document describes version 2.0 of the Objective-C language which is released with Mac OS X v10.5. Several new features are introduced in this version, including properties (see“Declared Properties”), fast enumeration (see “Fast Enumeration”), optional protocols, and (on modern platforms) non-fragile instance variables. These features are not available on versions of Mac OS X prior to 10.5. If you use these features, therefore, your application cannot run on versions of Mac OS X prior to 10.5. To learn about version 1.0 of the Objective-C language, read Object Oriented Programming and the Objective-C Programming Language 1.0.
Who Should Read This Document
The document is intended for readers who might be interested in:
Programming in Objective-C
Finding out about the basis for the Cocoa application framework
This document both introduces the object-oriented model that Objective-C is based upon and fully documents the language. It concentrates on the Objective-C extensions to C, not on the C language itself.
Because this isn’t a document about C, it assumes some prior acquaintance with that language. However, it doesn’t have to be an extensive acquaintance. Object-oriented programming in Objective-C is sufficiently different from procedural programming in ANSI C that you won’t be hampered if you’re not an experienced C programmer.
Organization of This Document
This document is divided into several chapters and one appendix.
The following chapters describe the Objective-C language They cover all the features that the language adds to standard C.
“Objects, Classes, and Messaging”
“Defining a Class”
“Allocating and Initializing Objects”
“Declared Properties”
“Categories and Extensions”
“Protocols”
“Fast Enumeration”
“Enabling Static Behavior”
“Selectors”
“Exception Handling”
“Threading”
“Remote Messaging”
The Apple compilers are based on the compilers of the GNU Compiler Collection. Objective-C syntax is a superset of GNU C/C++ syntax, and the Objective-C compiler works for C, C++ and Objective-C source code. The compiler recognizes Objective-C source files by the filename extension .m
, just as it recognizes files containing only standard C syntax by filename extension .c
. Similarly, the compiler recognizes C++ files that use Objective-C by the extension .mm
. Other issues when using Objective-C with C++ are covered in “Using C++ With Objective-C.”
The appendix contains reference material that might be useful for understanding the language:
“Language Summary” lists and briefly comments on all of the Objective-C extensions to the C language.
Conventions
Where this document discusses functions, methods, and other programming elements, it makes special use of computer voice and italic fonts. Computer voice denotes words or characters that are to be taken literally (typed as they appear). Italic denotes words that represent something else or can be varied. For example, the syntax:
@interface
ClassName(
CategoryName)
means that @interface
and the two parentheses are required, but that you can choose the class name and category name.
Where example code is shown, ellipsis points indicates the parts, often substantial parts, that have been omitted:
- (void)encodeWithCoder:(NSCoder *)coder
{
[super encodeWithCoder:coder];
...
}
The conventions used in the reference appendix are described in that appendix.
See Also
If you have never used object-oriented programming to create applications before, you should read Object-Oriented Programming with Objective-C. You should also consider reading it if you have used other object-oriented development environments such as C++ and Java, since those have many different expectations and conventions from Objective-C. Object-Oriented Programming with Objective-C is designed to help you become familiar with object-oriented development from the perspective of an Objective-C developer. It spells out some of the implications of object-oriented design and gives you a flavor of what writing an object-oriented program is really like.
Runtime
Objective-C 2.0 Runtime Programming Guide describes aspects of the Objective-C runtime and how you can use it.
Objective-C 2.0 Runtime Reference describes the data structures and functions of the Objective-C runtime support library. Your programs can use these interfaces to interact with the Objective-C runtime system. For example, you can add classes or methods, or obtain a list of all class definitions for loaded classes.
Objective-C Release Notes describes some of the changes in the Objective-C runtime in the latest release of Mac OS X.
Memory Management
Objective-C supports two environments for memory management: automatic garbage collection and reference counting:
Garbage Collection Programming Guide describes the garbage collection system used by Cocoa. (Not available on iPhone—you cannot access this document through the iPhone Dev Center.)
Memory Management Programming Guide for Cocoa describes the reference counting system used by Cocoa.
- Introduction to The Objective-C 2.0 Programming Language
- 《The Objective-C Programming Language》中文翻译文档
- Introduction to WebKit Objective-C Programming Guide
- The C programming language
- the c programming language
- The C Programming Language
- 《The Way To Go : A Thorough Introduction To The Go Programming Language》之数组切片
- The Way To Go- A Thorough Introduction To The Go Programming Language.pdf 英文原版 免费下载
- Introduction to the QML Language
- Briefing introduction to four programming language concepts
- 翻译《the c programming language》
- The C Programming Language--------(1)
- The C Programming Language 笔记
- 《The C Programming Language》笔记
- the C programming language 练习
- 翻译 The C programming language
- The C programming language 4.1
- <The C programming language> 5.2
- 转自OGRE的一些游戏编程的链接
- hibernate项目基本开发过程
- 配置Rational ClearQuest 悲观锁定
- 如何配置C#命令行编译器
- applet嵌入到jsp页面问题
- Introduction to The Objective-C 2.0 Programming Language
- HTML转义字符表
- 数组与链表等顺序表逆置
- JNI入门介绍
- 冒泡排序法的几种实现
- vc / mfc 快捷键 的实现
- datagridview 删除数据行
- 经典好文
- VS2008 快捷键大全(转)