Introduction to the objective-C Programming Language
Introduction to object-oriented C language programming:
Object-oriented C language is a simple computer language designed for advanced object-oriented programming. The object-oriented C language is defined as a small and powerful extension set of the Standard C language. It is an extension of C language but mainly based on the Smalltalk language, one of the earliest object-oriented programming languages. The object-oriented C language is designed to provide complete object-oriented programming capabilities for the C language, through a simple and direct method.
Most object-oriented development environments consist of several parts:
This article is the first part of the development environment-the programming language. It fully describes the object-oriented C language and provides the basis for learning the second part, mac OS X's object-oriented C language application framework-collectively referred to as cocoa. you can start to learn more about cocoa through articlesGetting started with cocoa.
The two main development tools you can use are xcode and interface builder. You can obtain the description from this webpage.Xcode workspace GuideAndInterface
BuilderThe separate. runtime environment is described in another separate document:Objective-C runtime programming guide.
Note:The objective-C version described in this document is released on Mac OS X v10.6 on the Apple Computer, introducing the new feature: associative references (see "associative
References "). To learn about objective-C version 1.0 (available on Mac OS X v10.4 or earlier), please read:
Object Oriented Programming and the objective-C programming language 1.0.
Who should read this document?
This document is intended for readers who may be interested in the following:
This document introduces the object-oriented model for implementing objective-C language. colleagues also fully introduce the language. The focus is on the extension of objective-C to C language, rather than the C language skills.
Since this is not a document about C language, it assumes that we know C language before. However, you do not need to have in-depth understanding. Object-Oriented Programming Based on objective-C is very different from programming based on standard C language. Therefore, you won't have too many obstacles, even if you are not an experienced C programmer.
Structure of this document
This document consists of several chapters and an appendix.
The following sections cover all objective-C functions for Standard C language extensions.
-
Objects, classes, and messages
-
Define a class
-
Protocol
-
Attribute Declaration
-
Categories and extensions
-
Association reference
-
Quick Enumeration
-
Enable Static Behavior
-
Selector
-
Exception Handling
-
Thread
The apple compiler is based on the GNU Compiler series. The objective-C syntax is a superset of gnu c/C ++ syntax, and the objective-C compiler applies to the source code of C, C ++, and objective-C. the compiler recognizes objective-C code files through the file extension.m, Just as it recognizes files that only contain the Standard C syntax through the file extension. CSimilarly, the compiler recognizes that C ++ files using objective-C language use the File Extension
.mmOther questions about using C ++ in objective-C are covered in the following document: "using
C ++ with objective-C ."
The references contained in the appendix may be helpful for understanding the language:
Conventions
This document introduces functions, methods, and other programming elements using special computer languages and italics. In computer languages, words or characters can be used directly and literally (the same as those in C ). italics indicate other things or changes (such as variable names ).
For example, Syntax:
@interfaceClassname(Categoryname)
Indicates@interfaceA pair of parentheses is required, but you can select a class name and a category name.
When the Demo code is displayed, the content indicated by the ellipsis is usually the content filling part, which has been omitted:
- (void)encodeWithCoder:(NSCoder *)coder{
[super encodeWithCoder:coder]; ...
}
The conventions in the appendix involved are described in the Appendix itself.
For more information, see
If you have never used object-oriented programming to create an application, read:Object-oriented programming with objective-C. If you have used other object-oriented development environments such as C ++ and Java, they have many different exceptions and conventions than objective-C.Object-oriented
Programming with objective-CTo help you get familiar with object-oriented development, designers develop towards an objective-C developer. It elaborates on some implementation of object-oriented design, and provides you with some tips about how to really write object-oriented programs.
Runtime Environment)
Objective-C runtime programming guideDescribes some situations of objective-C runtime and how you use it.
Objective-C Runtime referenceDescribes the data structures and functions that support the database during objective-C runtime. Your program can use these interfaces to interact with the objective-C runtime system. For example, you can add a class or method or obtain a list of all loaded class definitions.Objective-C
Release NotesDescribes the changes in the objective-C Runtime Environment of Mac OS X in the latest version.
Memory Management
Objective-C supports two memory management environments: automatic garbage collection and reference count:
-
Garbage collection programming guideDescribes the garbage collection mechanism used by cocoa. (Not supported on the iPhone-you cannot access this document through the iPhone Development Center .)
-
Memory Management programming guide for cocoaDescribes the reference counting system used by cocoa.
Note: This article is a direct translation of materials on the official Apple website and will not change as the webpage changes. For the latest official webpage, refer
Https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
Thank you for choosing to modify it ~~~~
Retained the following information:
Author (author): smilelance
Time 2010.02
Source (from): http://blog.csdn.net/smilelance