日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Objective-C 编程语言官网文档(一)-简介

發(fā)布時間:2023/12/20 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Objective-C 编程语言官网文档(一)-简介 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

聲明:本文檔僅為個人學習過程中順手翻譯之作,方便開發(fā)的同胞借鑒參考。如有覺得譯的不好不到位的地方,歡迎指正,將及時做出更正
盡量尊重原文檔,因為首次Objective-C,有些地方可能直譯了沒有注意該語言的專有詞,希望指正。如需轉(zhuǎn)載,請注明出處



我的編程環(huán)境:
IDE:XCODE4.3.1
OS: MAC OS X 10.7.4
文章來譯自:http://developer.apple.com/

簡介

Objective-C語言是一種簡單的基于當下先進的面向?qū)ο蟮囊环N計算機語言。它作為標準的ANSI C語言的擴展,輕量但很強大。相對C, Objective-C新加入的一些內(nèi)容更多是基于Smalltalk語言,Smalltalk是面向?qū)ο缶幊陶Z言的創(chuàng)始者之一。Obejctive-C被設(shè)計賦予C語言完整的面向?qū)ο缶幊痰哪芰?#xff0c;并以一種簡單和直接的方式來實現(xiàn)。
大多數(shù)面向?qū)ο蟮拈_發(fā)環(huán)境都包含下列幾部分:

  • 面向?qū)ο蟮木幊陶Z言;
  • 一系列的對象庫;
  • 一套開發(fā)工具;
  • 運行時環(huán)境;

本文檔是關(guān)于第一個部分的介紹,即編程語言。 本文檔還包含了一些有關(guān)學習第二部分的基礎(chǔ)知識--Objective-C應(yīng)用框架--Cocoa,運行時環(huán)境的表述可以參考另外一個文檔Objective-C Runtime Programming Guide.

適合閱讀本文檔的人群:
1.Objective-C的開發(fā)人員
2.想要了解Cocoa應(yīng)用框架基礎(chǔ)的朋友
本文檔不僅介紹了Obejctive-C的面向?qū)ο竽P鸵约罢Z言本身。專注于講解相對C擴展的東西,而不是C本身。
因為文檔并不著墨于C語言本身,可能有人覺得需要具備C的知識背景呢。作為一個面向?qū)ο蟮恼Z言,Objective-C是跟面向過程的C有著很大的區(qū)別,所以即便你不是一個有經(jīng)驗的C語言開發(fā)者,也不會妨礙你學習Objective-C
本文檔的組織結(jié)構(gòu):
  • “Objects, Classes, and Messaging”?(對象,類 以及 消息)

  • “Defining a Class”?(如何定義類)

  • “Protocols”?(協(xié)議/規(guī)則)

  • “Declared Properties”? (如何聲明屬性)

  • “Categories and Extensions”?(類目及擴展)

  • “Associative References”? ?(關(guān)聯(lián)引用)

  • “Fast Enumeration”?(迅捷枚舉)

  • “Enabling Static Behavior”?(使用靜態(tài)成員)

  • “Selectors”?(篩選器)

  • “Exception Handling”?(異常處理)

  • “Threading”?(線程)



關(guān)于文字字體協(xié)定的內(nèi)容不做翻譯了,呵呵,只是一些書寫慣例
其它:
如果你從來沒有使用過面向?qū)ο蟮恼Z言進行過開發(fā),那么你可以先閱讀下文檔Object-Oriented Programming with Objective-C. 同樣,如果你有過面向?qū)ο箝_發(fā)的經(jīng)驗,例如,C++, JAVA等語言的開發(fā)經(jīng)驗,你也可以看下上面提到的文檔, 因為他們雖然都是面向?qū)ο蟮?#xff0c;但很多內(nèi)容可能不盡相同。這個文檔講述了面向?qū)ο箝_發(fā)的思想以及一些基于面向?qū)ο笏枷氲膶崿F(xiàn)。
運行時環(huán)境
Objective-C Runtime Programming Guide?這個文檔向我們講解了有關(guān)Objective-C的運行時環(huán)境,以及我們?nèi)绾问褂谩?br />
Objective-C Runtime Reference?這個文檔則向我們介紹了Objective-C說支持的數(shù)據(jù)結(jié)構(gòu)以及函數(shù)。你的程序也許會用到里面的借口來與Objective-C運行時環(huán)境進行交互。


內(nèi)存管理
Objective-C支持三種方式的內(nèi)存管理:自動垃圾回收及引用統(tǒng)計
  • Automatic Reference Counting?(ARC), 自動引用統(tǒng)計,編譯器會推斷出所有對象的生命周期

  • Manual Reference Counting?(MRC), 手動引用統(tǒng)計,有時也叫MRR,即手動保持,釋放。用于你完全掌控并決定對象的生命周期。

    詳情可以參考?Advanced Memory Management Programming Guide.

  • Garbage collection, 垃圾回收,將決定對象生命周期的責任傳遞給自動回收器

    可以參考Garbage Collection Programming Guide. (但文檔不適用于iOS—IOS的你可以通過訪問IOS開發(fā)中心獲取該文檔.)


原文:(http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html#//apple_ref/doc/uid/TP30001163-CH1-SW2

?Introduction

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. This document also provides a foundation for learning about the second component, the Objective-C applicationframeworks—collectively known as?Cocoa. The runtime environment is described in a separate document,Objective-C Runtime Programming Guide.

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 frameworks

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. Object-oriented programming in Objective-C is, however, 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

The following chapters cover all the features Objective-C adds to standard C.

  • “Objects, Classes, and Messaging”

  • “Defining a Class”

  • “Protocols”

  • “Declared Properties”

  • “Categories and Extensions”

  • “Associative References”

  • “Fast Enumeration”

  • “Enabling Static Behavior”

  • “Selectors”

  • “Exception Handling”

  • “Threading”

A glossary at the end of this document provides definitions of terms specific to Objective-C and object-oriented programming.

Conventions

This document 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:

@interfaceClassName(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];
...
}

See Also

If you have never used object-oriented programming to create applications, 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 because they have many expectations and conventions different from those of 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.

The Runtime System

Objective-C Runtime Programming Guide?describes aspects of the Objective-C runtime and how you can use it.

Objective-C 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.

Memory Management

Objective-C supports three mechanisms for memory management: automatic garbage collection and reference counting:

  • Automatic Reference Counting?(ARC), where the compiler reasons about the lifetimes of objects.

  • Manual Reference Counting?(MRC, sometimes referred to as MRR for “manual retain/release”), where you are ultimately responsible for determining the lifetime of objects.

    Manual reference counting is described in?Advanced Memory Management Programming Guide.

  • Garbage collection, where you pass responsibility for determining the lifetime of objects to an automatic “collector.”

    Garbage collection is described in?Garbage Collection Programming Guide. (Not available for iOS—you cannot access this document through the iOS Dev Center.)

總結(jié)

以上是生活随笔為你收集整理的Objective-C 编程语言官网文档(一)-简介的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。